Try forcing an iPhone restart if it's not responding and you can't switch it on and off.
Click the volume up button, then immediately let go.
Click the volume down button, then immediately let go.
Long-press the side button.
Release the side button once you see the Apple logo.