If your door does not latch well, slowly open and close the door, to see where the latch bolt lands on the door jamb. If the door latches well, the latch bolt will enter the strike plate. If not, check for the following:
Hinge screws may be loose. Ensure all fasteners are tightened.
The gap between the door and the jamb may be too wide for the latch bolt. You may be able to adjust this with shims. Off-center latching can be fixed by shimming the door in the appropriate direction. If you are unable to fix misalignment with shims, you may need to reset the latch plates.
The doors may be warped and causing misalignment. It is possible you will need to purchase and hang a new door.