If pressing the volume buttons exposes the volume slider, then the physical hardware buttons are working - and can therefore dismiss the possibility of a hardware fault.
Try a forced-restart of the iPad - as this will usually clear an isolated software issue:
Force restart iPad (models with Face ID or with Touch ID in the top button)
If your iPad doesn’t have the Home button, do the following:
- Press and quickly release the volume button nearest to the top button.
- Press and quickly release the volume button farthest from the top button.
- Press and hold the top button.
- When the Apple logo appears, release the top button.

Force restart iPad (models with the Home button)
Press and hold the top button and the Home button at the same time. When the Apple logo appears, release both buttons.

A reset of your iPad settings may also resolve the issue:
iPadOS14 and earlier
Settings > General > Reset > Reset All Settings
iPadOS15 onwards
Settings > General > Transfer or Reset iPad > Reset > Reset All Settings