Over time, certain doors in your home may become difficult to open and close due to uneven long-term settling of your home, and knowing how to fix a stuck door, will prevent hours of frustration. Other causes of stuck doors include permanent changes to the door and/or frame shape caused by long-term exposure to humidity, and poorly installed or loose hinges.
First, attempt to close the door and take notice of where the door hits the doorframe. If your door is hitting the top of the door frame towards the side where the lock is installed, then the uppermost hinge can be shimmed with a piece of cardboard cut to fit into the uppermost hinge indentation. Unscrew the side of the uppermost hinge which connects directly to the door itself, slide the fitted cardboard piece in, and re-screw the door side of the hinge back into the door. This will slightly lower the side of the door towards the lock side of the frame, increasing the likelihood of proper clearance upon closing.
If your door still doesn't open and close properly after installing the cardboard shim, one of the sides of the door will either need to be planed or sanded. Closing the door as far as it will go, move the metal point of a pencil compass down the edge of the doorframe, with the pencil on the side of the door, which is hitting the frame. This will mark a line indicating exactly where the door is sticking so you know where to shave or sand. At this point in the procedure, you can either remove the door from its hinges by pulling out the hinge pins, making it easier to position the door for planning down the marked area, or you can leave the door in place and attempt to sand the marked area down. If you opt to sand the area with the door in place, use 60 or 30 grit sandpaper attached to a sanding block. With either method, be sure to keep a close eye on the mark you've made while sanding to prevent going past it.