The FaceID camera array is reliant upon several components - including an IR camera and IR dot-projector. If any element of the array is faulty, FaceID will not work.
This iPhone User Guide describes setup and use of FaceID on supported models of iPhone:
Set up Face ID on iPhone - Apple Support
If FaceID isn't working as expected, or has been disabled, you’ll need to follow this guidance:
If Face ID isn't working on your iPhone or iPad Pro - Apple Support
If an alert says Face ID has been disabled on your iPhone or iPad Pro - Apple Support
If you unable to resolve a problem, you would be well advised to seek assistance directly from Apple Support:
Official Apple Support
You might also visit the Genius Bar at your local Apple Store or Apple Authorised Service Provider (AASP) - where the technicians will be able to test and assess your device. If a fault is confirmed, you'll be in the best possible place to explore your available options:
Genius Bar Reservation and Apple Support Options - Apple