Music on a phone or computer is digital. To get analog output for the headphone jack the device includes a DAC to convert that digital audio to analog and probably analog amplifiers to get the analog signal to the right level. The quality of the DAC and the analog amplifiers chosen by the device maker place an upper limit on the quality of the audio.
To get the highest quality you want to be able to choose the DAC and amplifiers yourself.