It can be because of stripped screws in the top hinge that finally give out or simply the weight of the door.
Top door hinge loose.
If one is loose remove two or more screws and try driving in longer screws.
Tap the tee into the hinge screw hole with a hammer.
Open the door wide and insert a wedge under the bottom outside corner to level it.
Reinstall the hinge and screws in the holes.
Test the hinge on the latch side a door is cut at a slight bevel to make it easier to close.
Remove the screws that hold the loose hinge leaf to the door jamb.
If the hinge and jamb are painted cut the paint around the leaf with a utility knife swing the leaf away from the jamb.
How to tighten stripped hinge screws.
If a door binds open it grasp the knob and lift up to see if a hinge is loose.
First check that the hinge screws are tight.
Binding problems at the top of any door are usually the result of a loose hinge.
If the hinge pin falls out.
Ask a helper to hold up the door and align the pin barrel on both halves of the hinge.
Remove the loose screws.
If you encounter movement at the hinge screws they need to be retightened.
Allow the glue to dry.
Open the door grasp it by the lock edge and move it up and down.
Score the tee with a utility knife flush with the mortise.
Tap the hinge pin back into the door with a hammer at the top of the pin barrel.