App to lock the phone “right now”
[Apple] - Use Emergency SOS on your iPhone:

Press and hold the side button and one of the Volume buttons until the Emergency SOS slider appears.


This locks the screen and requires a pin:

If you use the Emergency SOS shortcut, you need to enter your passcode to re-enable Touch ID, even if you don't complete a call to emergency services.

If that doesn't work (iPhone 7 and earlier):

Rapidly press the side (or top) button five times.

Note that you may want to turn off &quot;Auto Call&quot;, to avoid accidentally calling emergency services. This can be done in the &quot;Emergency SOS&quot; settings.