Volume buttons fail from dirt, wear or a torn flex.
1. Remove the case and press the buttons. Thick cases can block them.
2. Clean around the buttons with a soft brush and a little isopropyl alcohol, then press them many times.
3. Check the volume changes with on-screen controls, to rule out software.
4. Open the phone and inspect the volume flex for tears or corrosion.
5. Replace the flex or the small switch if it no longer clicks.
You can still change volume from the settings or with accessibility buttons on screen while waiting for a part.