The problem of Volume buttons not working on iPhone or volume not responding when you try to increasing or decreasing the volume can be caused due to both Hardware and Software related issues.
If the issue is hardware related, you should be able to control the volume by using virtual volume up and volume down buttons as available in the AssistiveTouch menu on your iPhone.
However, in most cases the problem is likely to be software related and it can be fixed by using troubleshooting steps as provided below in this guide.
Volume Buttons Not Working on iPhone
Before going ahead with the troubleshooting steps, make sure that the problem is not being caused due to operation of volume buttons on your iPhone being impacted by the case/cover.
Remove iPhone from its protective case/cover (if you are using it) and see if you can increase or decrease the volume by using the physical volume buttons.
If you cannot change the volume, even after removing the case/cover the problem is due to other issues which can investigated and hopefully fixed using the following troubleshooting steps.
1. iPhone Stuck in Headphone Mode
Press the Volume Up and Volume Down buttons on your iPhone and see if you can see the Volume indicator appearing on the screen of your iPhone.
If the Volume Indicator shows a Headphone Icon, instead of Speaker Icon, your iPhone is stuck in Headphone Mode. For more information and steps to fix this issue, you can refer to this guide: Fix: iPhone Stuck in Headphone Mode
2. Enable Change with Buttons Option
If the sound is not increasing or decreasing when you use the physical volume buttons, the problem is usually due to change with button option not being enabled.
1. Go to Settings > Sounds & Haptics.
2. On the next screen, enable Change with Buttons option.
3. Use the Slider to set the volume to your desired level.
When you drag the slider, you will see a pop-up message and hear iPhone playing a Sound to indicate the set volume level on your device.
3. Adjust Volume Using Music, Video and Podcast Apps
Most Music, Video and Podcast Apps provide the option to increase and decrease the volume level, without using the physical volume buttons.
For example, when you play Music on iPhone, the Music App shows a horizontal slider that can be used to adjust the volume of the song that you are playing.
Similarly, other Apps that play Podcasts, Videos and Music should display a similar horizontal volume slider or volume control option.
4. Use AssistiveTouch
If the volume buttons are stuck or not working, you can control the volume on your device by using virtual volume buttons, as available in the Assistive Touch menu.
1. Go to Settings > Accessibility > Touch.
2. On the next screen, enable AssistiveTouch by moving the slider to ON position.
This will place an AssistiveTouch button on the screen of your iPhone, which provides access to virtual volume up and volume down buttons.
Once the Assistive Touch menu is available, you can increase or decrease the volume on your iPhone by tapping on the AssistiveTouch Icon and selecting the Device option in the Assistive Touch menu.
On the next screen, you will see the virtual Volume UP and Volume Down buttons, which can be used to increase or decrease the sound on your iPhone.
5. Hard Reset iPhone
The steps to Hard Reset iPhone vary, depending on the Model of your iPhone.
iPhone X and above: Press and release Volume up button > press and release Volume down button > press and hold the Power button (Side button), until you see your device starting with Apple Logo.
iPhone 8, 8 Plus: Press and release Volume up button > press and release Volume down button > after this press and hold the Power button, until you see your device starting with Apple Logo.
iPhone 7, 7 Plus: Press and hold Power and Volume down buttons, until you see your iPhone starting with Apple Logo.
iPhone 6s and below: Press and hold Power and Home buttons, until you see your device starting with Apple Logo.
6. Use DFU Mode
The problem of volume buttons not working on iPhone can also be caused by corrupted or damages firmware files. This can be fixed by putting your iPhone in DFU Mode.
DFU Mode completely wipes the data on your iPhone and reinstalls both Operating system and the Firmware on your device.
For more information and the steps to put iPhone in DFU Mode, you can refer to this guide: How to Enter DFU Mode on iPhone.