The Apple iPhone X will only show lockscreen notifications with actual content when it knows you are the one who is watching and if it's somebody else, they will only see the notification source, but not the notification content itself (which might be sensitive).
The future also comes with iOS 11 to earlier iPhones, but it's slightly modified: since you do not have Face ID on those earlier models, you can go into settings and enable showing notifications with content / preview only when the device has been unlocked.
This replicates settings that have been implemented in Android notifications long time ago: you can set Android lockscreen notifications to appear with content on or with the content hidden, while the second option was up until now completely missing from iOS. What iOS did offer up until now was two options, which were either to show full lockscreen notifications with content or not show lockscreen notifications at all (to be perfectly exact, the feature was available in Mail and Messages, but nowhere else).
Here is how to manage lockscreen notifications in iOS 11 (keep in mind that you need to have entered a passcode and / or Touch ID or Face ID for this to work):