Can't tell without seeing your problem but, most problems with doors start with worn out door hinge pins and bushings. Letting the hinge pins and bushings wear out leads to damaged door latches and strikers.
Fod product? Spray the door latch assembly liberally with WD-40, operate the door a few times then spray with a silicone spray
how do you fix a prosthetic leg that the release screw wont go all the way down in to the socket
ther is a loose connection in your ignition. when you slam the door or some thing of that nature it will fix the problem momentarily or it wont sometimes.
If your car has been injured in an accident, there might be a lot of damage thatcan't be seen. Various body tweaks can stop a door from closing properly.If the door is just rusty and old, it might be sagging. Or the latch might be old and worn.I'd try to get with a body technician for an evaluation.
tape :)
use jumpers
make sure your door shims are not worn out,....open the door half way and lift the door up, if you feel slight movement or looseness in the door you may have to replace the shims
Unlock it.
Make sure that the door hinges are adjusted properly and the door shuts tight. The latch pin and catch need to be checked as well. The most common cause is misalignment.
First you need to know what is wrong with it before you can fix it.
Manipulate the steel to the point where it fits in the proper locations or replace the door. Hopefully the damage done was only to the door and not the frame of he car. If the frame is damaged it is unlikely this issue can be fixed effectively or easily.
To fix a car door that is sprung due to a bent or damaged hinge, the best thing to do is replace the hinge. If the hinge is welded and not bolted to the vehicle, the entire door will have to be replaced.