If you have an iPhone, just squeeze the volume up and power button if you’re worried about it. This causes the phone to require a passcode for the next login.
Just to clarify for anyone else who was confused by this and didn’t understand what was meant by “squeeze”:
Just tapping volume up and the power button just takes a screenshot. (Which is why I was confused)
Instead, hold the volume up and power button until the power off screen shows up. Even if you cancel the shutdown, the iPhone will require a passcode to unlock.