You could try these to things:
iOS 14 has the Tap Back feature. It allows you to do a quick double or triple tap on the back of your iPhone. With tap back you can open Control Center, take a screenshot, mute (i.e. ringer silent mode on or off), trigger accessibility-specific actions, and more. You may inadvertently have the double or triple tap back set to mute which will get triggered with accidental taps to back of phone.
To Access Back Tap:
Check that you have the latest version of iOS on your iPhone 8 or later.
Go to Settings > Accessibility > Touch, and tap Back Tap.
Tap Double Tap or Triple Tap to see if mute has been selected on either tap. (I tried it out by setting my switch manually to silent mode off. I set my double tap to mute. I went back to my Home Screen and then gave the back of iPhone two quick taps and saw the top of my phone read “silent mode ON”..)
If that was not successful, try the following:
Hard reset or force restart (sample for iPhone 12):
1. Quickly press and release the Volume Up button.
2. Quickly press and release the Volume Down button.
3. Press and hold the Side button until the Apple logo appears, then release the Side button