I don't want to step all over Gomez, but I disagree with him. Unless the door is way out of whack, rehanging probably isn't necessary. And using long screws in a hinge is a big no-no.
Shimming door hinges requires a little thought about geometry. You can use a shim on a hinge to move the door either direction- further towards the striker or away. It depends on where on the hinge you place the shim.
Shims should be as tall as the hinge, but only ~1/4" wide, and usually are compressed cardboard 1/16" or less thick. They are placed outside the screws, on the pin side or opposite the pin on the door stop side of the hinge. No part of the shim should be inside the screw pattern. This allows for leverage, and gives the most overall adjustment from the thinnest possible shim. Putting a shim next to the pin moves the door away from the hinge side of the jamb, a shim on the door stop side of the hinge brings the door closer to the hinge side of the jamb. Shims can be used on either the jamb or the door half of the hinge, or both in extreme cases. I prefer to start with the jamb. In most cases, to align the striker you will shim 2 hinges on a 3 hinge door to prevent binding. The middle hinge should be shimmed 1/2 as much as the first hinge. In some cases you shim the top and bottom hinges and not the middle- top hinge by the pin, bottom hinge by the doorstop or vise-versa.
Determine where you need to move the door by looking at the closed door in relation to the jamb. You want the space around the door to be equal. If the door is touching the jamb anywhere, it should be shimmed. Sometimes the door wasn't hung correctly by the installer, so you also have to look at the strike and make sure your adjustments aren't going to throw it out of alignment. If you have a lot of space by the top hinge, less at the middle, and equal space at the bottom hinge on the hinge side and the strike side, you would probably put two shims on the doorstop side of the top hinge, one shim on the doorstop side of the middle hinge, and no shims on the bottom hinge. If the top hinge has a large space, the middle hinge is equal on the hinge side and strike side, and the bottom hinge has little or no space, you would put one shim on the doorstop side of the top hinge, no shim on the middle hinge, and one shim on the pin side of the lower hinge.
To install shims, open the door 90 degrees. If it's a 3 hinge door, you can pull the screws out of one hinge, install the shims, and replace the screws. Two hinge doors require you to support the weight of the door while one hinge is being worked on, but fortunately they are usually lightweight interior doors. Don't close the door until you shim all of your hinges or you can damage the hinges or jamb. I usually moisten the cardboard shims enough to get them to stick until I screw the plate in place. Often I will just loosen the screws and slip the cardboard shim behind the hinge plate, then retighten. Sometimes I see masking tape used as shimming material, multiple layers to get thickness. That's nice because it doesn't fall out, and it's easy to get different thicknesses.
Long screws can pull the jamb out of alignment. The jamb is shimmed in the rough opening, so there is space between the framing and the jamb. If you drive a screw into the framing and run it tight, you will pull the jamb towards the framing and pull the jamb out of true.
Most people want to use long screws because the holes in the jamb are stripped out. There is a very easy fix for that problem. Cut 1/4" dowel into ~3/4" long pieces. Drill the hinge holes out with a 15/64" bit. Squirt wood glue into the holes, tap dowel piece into hole until flush. Wait 5 minutes, drill pilot hole for screw. Better than new. This method also works for relocating holes, such as for a striker plate that you want to move 1/2 the distance of the hole. That usually requires re-mortising the plate though, so it's always better if you can align the door in the jamb.