Welcome to the forum!
This is a rather common issue with several Ford models. The door ajar sensor/switch is located in the door latch assembly and the switch gets dirty over time.
I've had good luck spraying the latch assembly with electrical parts cleaner, then I open and close the door several times. I follow that up with an application of Caig brand De-Oxit, again open and close the door several times, and finally I spray Caig Presev-It in the latch assembly, then cycle the door several more times. Once I confirm that the door switch is functioning reliably, I lubricate the door latch assembly with either silicone spray or a Teflon dry lube.
Several other folks have used WD-40 in the latch assembly and have been pleased with the results. I shy away from WD-40 though as it is not an electrical contact cleaner nor is it a electrical lube. But I also realize the Caig products are not readily available in most parts of the country so I throw the WD-40 option out there.
-Rod