If you are on Android 10 or 11 there is a “sensors off” quick settings tile you can enable in the Developer Settings.
This block camera, microphone, and all sensors (gryo, compass).
On Android 12, there is one for camera and another for microphone in the standard quick tiles choices.