To shut down your phone, you can press and hold the side button to activate your phone’s assistant, then say “Power off” into the microphone to bring up the power off menu.
Alternatively, you can change the side button’s function so it works solely to power off your phone. On a Samsung phone, go to Settings > Advanced features > Side button, then select “Power off menu” in the “Press and hold” category. On a Pixel, go to Settings > System > Gestures, then tap “Press & hold power button.” From here, select “Power menu.”