Apple - Why does my iPhone 7 have a laser?
This site indicates that the front facing proximity sensor consists of the laser and filters to attenuate the signal to safe levels once assembled.
Located in the front of the phone, above the main speaker, the FlightSenseTM proximity sensor uses optical land-grid array (LGA) packaging. The custom Apple device measures 2.80 mm x 2.40 mm, half the size of the rest of STMicroelectronics’s portfolio.
That reinforces the warning about repair and implies potential danger if you operate the components while the iPhone is disassembled.