I had this issue for years, I was always worried about it, but it only started getting progressively worse this past year. I suspected it was humidity but I never really knew.
About a month ago my iPad disabled Face ID saying it detected an issue, but it said "hey maybe after an update, it'll be fine" and coincidentally the error happened the same day a new iOS came out, I guess 18.5. I updated and Face ID worked again. When 18.5.1 came out, Face ID was disabled again.... I update and it's fine. But next morning: disabled again. I don't really want to do this cat-and-mouse game. I don't want to do a fresh iPad restore as I don't use iCloud.
Needless to say I take the iPad to the Apple Store (I got this iPad 4 years ago, on release day. It's the 12.9" M1 iPad Pro) and they run the diagnostic which doesn't detect any physical problems. The Genius admits if it were an iPhone they could actually repair it for me, but since it's an iPad they quoted me a costly option (basically replacing the device).
This was my first time buying an iPad under what I'd call "unhappy circumstances". I probably should've taken my iPad to the Apple Store the moment I noticed the stuff under the camera instead of waiting so long. I don't even know if it's a coincidence that this happened and then my sensor died.
Despite having a busted Face ID, since the iPad still passes Apple's diagnostic checks: I got full trade-in value on the iPad. But I still spent a lot of money on a replacement device.