If you want to avoid accidentally making a call when your phone is in your pocket or bag, you can lock your keys and screen. You can also set the keys and screen to lock automatically.
The pictures are examples from Lumia 950. In Lumia 950 XL, the power key is located between the volume keys.
To lock your keys and screen, press the power key.
Unlock the keys and screen
Press the power key, and drag the lock screen up.
Tip: If you can hide your navigation bar, you can also lock your keys and screen by double-tapping the bar. To turn this feature on, swipe down from the top of the screen, tap All settings > Personalization > Lock screen, and turn Double-tap the navigation bar to turn off the screen on.
Set the keys and screen to lock automatically
Swipe down from the top of the screen, tap All settings > Personalization > Lock screen, and under Screen times out after, select the length of time after which the keys and screen are locked automatically.