There is a pattern to this as to what it does when, but it does bother me that it changes. By default, if you're doing something that qualifies as media playback / game sounds etc., the volume buttons will adjust the media / playback / sound volume. If you're just at the home screen / lock screen with no media playing it will adjust the ringer/notification volume.
This sucks, in my opinion, so a better solution overall for me was to go into settings -> sounds and haptics and turn off "Change with buttons". Then, set the ideal ringer/notification volume there (which obviously only applies when the ringer/notification mute switch isn't in the silent position). From that point forward the volume buttons only duty, no matter what or where you are, is to adjust media/general sound volume. I habitually drop that to a very low if not no volume when not being used, TBH. Then I use the mute switch on the side of the phone to either enable or disable my notifications/ringers. I don't need to regularly adjust what volume level the ringers are at, so if I ever do want to make an adjustment, it's easy enough to go into settings -> sounds and haptics and make the change there.
I actually prefer it, as I can't accidentally hit the buttons and turn my ringer to really low without realizing it. The silent switch was hard to "accidentally" flip, as it was pretty small and a tight switch (this is good IMO), and once you put a case on your phone it's easy enough to flip when you are actively trying to but difficult for anything to accidentally flip it. This new action button seems like a step in the wrong direction to me. It will eliminate the tactile feel. I carry my phone on my belt clip, and if I'm walking into a meeting I can reach down and feel whether my phone is silenced already or not and switch accordingly... No visual cue needed, no worrying about "did I feel it vibrate to indicate I made the change or not"? etc. I did not have to wake the screen, if it was lying on my desk I could see the current state at all times.