Hi. I recieved the phone a couple days ago. My headphones are working functionally with the smartphone. But as I said in the title, there are problems with the volume and quality of the sound.

I was using the headphones previously on galaxy s3. The sound level comes only half as loud when I set it to full volume. And there is a lot of sound loss on the songs I listen to. Is there any ussd code or something so that I can try to solve it?

I do not think that there is any chance to verify by a simple USSD code. Here some ideas:

Clean the audio jack.
Maybe some dirt got in it, even a small piece could cause such issues. Best is to use a tooth pick and “scratch” the jack carefully. Otherwise you can try with pressured air (do not blow into it with your mouth).

Try different headphones.
Unlikely that this is the issue, but give it a try.