The question it answers
Liveness detection checks whether a face capture comes from a real, physically present person — not a printed photo, a screen replay of a photo or video, or another form of static reproduction.
Why it has to run first
If liveness isn't checked before a face comparison, a convincing enough photo could, in principle, be compared successfully against a reference image. Running liveness first means a spoofed capture never reaches the matching engine at all.
What it typically catches
In practice, that means catching printed photos held up to a camera, videos or photos replayed on a second screen, and captures of low enough quality that liveness can't be confidently assessed either way.