What is the year, make, and model of your vehicle?
Hello! I'm Rixster...
It sounds like you may have an issue with the Door Latch Assy. being gummed up and not alowing proper function. These have a switch inside that turns on the dome light and that pesky "Door Ajar" light too.
You can sometimes clean this with a stream of pentrating oil and compressed air.
Spray it in all directions directly into the Latch Mechanism then hit it with the air in all directions. Do this several times. It can make a nice mess. The penetrant acts like a solvent and will clean out any dust or debris accumulated hendering proper function.
If this doesn't help you may need to consider replacing the Latch Assy.
I hope this helps...