Basically all current high-value phones offer good sonic performance. The DACs in particular are reasonable quality, if not the very best.
If you use the amplifier, you may have trouble with In-Ear-Monitors, especially multi-transducer versions, but conventional phones and earbuds generally work fine. Considering the type of ear buds or headphones typically used with phones, they are of relatively well matched sonic quality.
Very good headphones or IEMs might reveal sonic shortcomings of the amp in particular, but the DAC's sonics should also be evident.
Best quality is available in three ways.
One, by using the line out, bypassing the built in amplifier but using the phone's DAC chip.
Two, by bypassing the built-in amplifier with an external amp but using the phone's DAC chip. Unfortunately many third-party portable amps do not use the line out, and instead still go through the built-in amp (anytime you plug into the headphone jack), which is not ideal.
Two, by interfacing with a device that can bypass the phone's built-in DAC chip and use a better quality DAC.
If you go this route, Apple phones offer the best options.
I don't find the built-in DACs of phones to be as bad as some suggest, but certainly using something like an external DAC with ESS Sabre chips (for example; there are others) can offer better sonics, in subtle but noticeable ways. If you are using a good sound system or good IEMs or headphones you should notice an improvement.