How can I manually lock an iPhone X screen
You can press the side button once to lock your iPhone X screen. This puts your iPhone to sleep mode and locks the screen (you'll be required to verify with facial attention or input passcode to unlock).

For more details, refer to the Apple Support article:


Use gestures to navigate your iPhone X and later



  Wake and sleep
  
  Raise to wake or tap to wake your iPhone X.
  
  To put your iPhone X to sleep, press the side button.
  
  


As pointed by @ernie, it's worth noting that an iPhone X with Face ID enabled unlocks as soon as you look at the screen when it is in awake state. To test that the screen was locked using this approach, you'll need to wake the device while not directly looking at the screen.



If you are not using Face ID

If you have turned off Face ID for your iPhone X, you'll need to enter your device Passcode to unlock. However, there's an additional setting which could prevent your device from going into lock mode after turning off the display by pressing the Side button. It is possible to set a time duration until which the iPhone is not locked (when you have turned off Face ID). To lock your iPhone immediately after putting the display to sleep after pressing the Side button, go to Settings app → Face ID &amp; Passcode → Require Passcode and tap on Immediately.