With the release of the latest Android Operating System (Android 12) the functionality for volume control for certain Android device models has changed while casting.
While this is looked into by Google, as a workaround, instead of simply using your volume buttons, you can tap the Chromecast notification icon, then proceed to change the volume, either by using the volume keys or the on-screen volume slider.