Biometrics
The right face, and a real person
The selfie is matched against the photo stored on the chip, not against a photo of the document that could be edited.
Liveness detection checks that a real person is in front of the camera. This protects you against photos, masks, screens and deepfakes.