Diagnosis
The door latch mechanism (the part on the door frame, not the tub) has likely failed. On this model, it's a known issue where the plastic housing of the latch assembly cracks, preventing the hook from engaging properly.
How to Fix It
You need to replace the door latch assembly. The part number is typically W10878679. It's a straightforward repair: open the door, remove the two or three screws holding the old latch in place from the inside of the door frame, disconnect the wiring harness (it carries the door switch signal), and swap in the new one.
If That Didn't Work
If a new latch doesn't solve it, the strike (the metal hook on the tub) might be bent or misaligned. You can gently adjust it with pliers. Rarely, the main control board could have a faulty door switch circuit.
Heads Up
Don't bypass the latch by jamming the door switch. The dishwasher uses the door switch signal for safety and to manage fill sequences. Running it with a bypassed switch can cause leaks or other operational faults.