There are two different channels for audio on your iOS device: there are ringers and alert sounds and there are media sounds, like from the Music app or various games on your iPhone.
The hardware volume buttons on the side of your iPhone are set to control both by default, but you can separate it out, making the hardware buttons only turn down the media sounds instead of both media and ringer sound.
Here’s our recipe on how to make sure you never miss a call because someone “accidentally” turned your volume all the way down.