I'm no expert, but my understanding, from reading a fair bit on the subject, is that the quality of the hardware and its implementation - engineering and software - both matter when it comes to sound quality (and the other huge element, the earphones of course).
Sony's experience in audio may well mean that their implementation of the standard Snapdragon DAC is better than average. My wife's Z5 certainly sounds better to me than my son's Samsung, but it's hard to say for certain without ABX testing.
Most people seem to think that LG have taken a superior DAC and implemented it really well. It is at the bottom of the phone, where it gets much less interference from other components, and the consensus seems to be that it works superbly. To my less than perfect ears, with my EPH-100 in-ears, the V10 sounds better than any other audio device I own.
However, whether the difference is that great in most real world situations, I'm not so sure. If you listen mostly on your morning commute then I would have thought that spending a bit extra on some decent headphones would be much more beneficial.
However if you use your phone to play FLACs or TIDAL HiFi streams via auxiliary cable to even a semi-decent set of speakers then the difference between the V10 and the Z5 is pretty striking. I was rather surprised at the difference, to be honest.
So yes the V10 is probably the best sounding phone for now, but whether that really matters is very much down to each person's particular set of circumstances.