How to lock screen orientation
If you turn your iPhone sideways, the screen automatically switches from portrait to landscape mode. However, that is annoying, especially when you are lying down and trying to change your position with your iPhone, because the screen constantly rotates to be right side up. To prevent this, you can lock the screen orientation on your iPhone.
Open Control Center
Swipe up from the bottom edge of any screen to open Control Center.
Lock screen orientation
Portrait orientation lock is the last icon in the first row of the Control Center. Tap on the icon, and the screen orientation will stay locked in portrait mode. The icon will have a white background to show screen rotation lock is enabled.
A lock icon appears when the screen orientation is locked
A little lock icon appears next to the battery icon in the status bar when the screen orientation is locked.
Now the screen will no longer rotate no matter how you hold your iPhone.