From a phone perspective, you'll want to think about the phone’s DAC and the power it puts out to the headphone jack (headphone amp)...if you're using wired earphones. In a budget phone these will be just-average but would be fine for your average earbuds but you might not want to plug Sennheiser HD600s in as they'd be underpowered and you might even hear the lesser DAC.
If you'll be using Bluetooth headphones/earbuds they'll offload the DAC/headphone amp requirement. I'm simplifying all this and there are other factors into how your setup will sound (wired earphones/headphone ohms, Bluetooth version etc) but these are the basics.
TLDR: For cheap wired earbuds or bluetooth most budget phones will sound the same. YMMV.
EDIT:. Wanna make ANY phone sounds its best for a wider variety of earbuds/headphones? Consider a small external USB DAC/headphone amp like the Dragonfly Black, Red, or Cobalt.