Step 1: If your iPhone screen is awake, quickly press the Side button located on the right side of the phone.
Step 2: The screen should immediately turn black and lock itself.
Step 3: To unlock the screen again, press the Side button again.
Step 4: When prompted, enter your passcode or use Touch ID or Face ID to re-access the iPhone.