A door that will not latch does not always need a new lock. First, close the door slowly and watch where the latch hits the strike plate. If the latch is above, below or beside the opening in the strike, the problem may be alignment rather than the lock itself.
Check whether the door rubs at the top, bottom or side. Look for loose hinge screws, a gap that changes from top to bottom, or a door closer that pulls the door too hard or too weakly. Tightening visibly loose hinge screws may help, but stripped screw holes, damaged frames or heavy commercial doors usually need a proper repair.
Do not grind, file or force parts unless you understand what changed. A quick cut in the wrong place can create a weaker repair later. If the door is in a storefront, apartment building or fire-rated opening, hardware and closing behavior should be handled carefully.
Send photos of the full door, hinges, latch, strike plate and frame. A short video of the door closing is useful. Include your ZIP code and say whether the door used to latch normally, whether it recently hit something, or whether weather changes made the problem worse.