Three basic troubleshooting steps to perform (test after each attempt):
A) Try a "forced" restart of your device using these instructions: Put it on charge for at least half an hour, then, keeping it plugged in, use these gestures:
Press and quickly release the volume up button, press and quickly release the volume down button, then press and hold the side (power) button. Only when the Apple logo appears (it might take 10-20 seconds), release that button (ignore all other screens that might appear, the one with the "slider" to turn the device off included).
B) If you can, check your battery status in Settings>Battery>Battery Health & Charging>Maximum capacity. If it is close to 83-80%, have it replaced as soon as possible, since it might have unpredictable behavior.
C) If you're sure that nothing (case/cover, screen protector, dirt) interferes with your front camera (remove any obstacles, if present), see this support article:--> If Face ID isn't working on your iPhone or iPad Pro and/or this one:--> If an alert says Face ID has been disabled on your iPhone or iPad Pro.
If the issue persists, after performing all the steps provided in the above support articles, contact Apple Support directly, using this specific link:--> Apple Support
If the issue still persists, it might be a hardware (digitizer? other internal component?) failure, and I suggest that you make an appointment (*) and have your device inspected at an Apple Store or AASP (Apple Authorized Service Provider) among this list:--> https://locate.apple.com/choose-country-region . After checking it out, they'll give you all the available options.
Regards
Giulio
(*) You can do it: