I made a video showing how I repaired a door. This door was out of plumb, level, and square, with loose hinges. It was almost impossible to lock the deadbolt because it was out of alignment. Now it works great.
I use Pest Block insulating foam sealant to fill small holes and large gaps around the outside of the house. Mice, rats, and bugs can chew through regular spray foam. The special variation of Great Stuff “Pest Block” foam solves this issue.