If you don't want your screen to rotate whenever you tilt your device then follow these simple steps to prevent it.
Step 1 - From anywhere on your iPhone just swipe upwards, you can even do this when the phone is locked if you wish, and a menu of adjustment options will appear.
Step 2 - Along the top of this menu there will be a row of circular icons, including Airplane mode, Wifi, Bluetooth, Do not disturb mode and finally Screen rotation.
Step 3 – Tap the screen rotation lock and it will turn white, this means that it is on. Simply follow the same steps if you wish to allow screen rotation again.