Start here: what the misalignment is telling you
Close the door and squat down so your eye is level with the lock. Throw the handle slowly and watch where the hook goes.
If the hook swings out and lands below the keeper slot, the panel has dropped. That's a roller or keeper height issue and it's the most common version of this complaint by a wide margin.
If the hook lines up vertically but stops an inch short of the jamb, the door isn't closing all the way. Different problem, different fix, and it's usually free to solve.
If the hook is off both up-and-down and in-and-out, look at the frame. Something has moved that isn't the door.
- Hook below the slot: sagging panel (rollers or keeper)
- Hook above the slot: someone over-adjusted a roller
- Hook short of the jamb: closure obstruction
- Hook angled or twisted: worn lock body or racked frame
How the lock and strike actually work
Nearly every residential sliding patio door uses a mortise lock buried inside the leading stile, the vertical edge that meets the jamb. Turning the handle rotates one or two steel hooks out through a slot in the stile face.
Those hooks catch a keeper, which is the small metal plate screwed to the fixed jamb. Some brands call it a strike, some call it a keeper, and the parts counter will know either word.
The engagement window is small. Most hooks have about 1/16 to 1/8 inch of vertical slop before they stop catching cleanly, and maybe 3/16 inch before they miss entirely.
That's why a barely visible sag breaks the lock. The door still looks perfect and slides fine, but the hook is now hunting for a slot that moved.