Using an outboard DAC will improve the sound quality. If you use a DAC you have to use a headphone amp (built into the DAC or separate) since you are bypassing the one built into the iMac.
If your headphones are high impedance or difficult to drive a headphone amp alone will be an improvement but not a much as using a DAC too.