I used to have a problem with sound, but I figured that it was the cord not the phone.
Try other headphone cords.
I had bought one not to long ago and it didn't work period. My phone notified me saying to pick up a different pair of headphones(basically)
Sony Xperia Z5 Premium Dual