Technically, Face ID relies on live facial recognition, which involves analyzing features like depth and movement. The system uses infrared sensors and a dot projector to create a 3D map of the face. For it to work, the device needs the user to be alive and conscious, as it looks for specific signs of life, such as blinking or slight facial movements.
In a scenario where someone is deceased, those vital signs wouldn't be present, preventing the device from unlocking. Additionally, Face ID includes security measures that would prevent unauthorized access, even if a deceased person's face were presented to the phone. This is why such depictions in movies are unrealistic; they overlook these essential technical details.