The Door Ajar Switch has a locking collar with two slots to insert a small screwdriver blade.
To remove the switch - Put the screwdriver blade in and twist. The locking collar pops out. Then pry behind the switch and the switch comes out.
The connector is not locked. Just pull the switch away from the connector.
The new switch adjusts by unlocking the locking collar. It's hard to slide. I put a pair of wire strippers in between the adjusting ring and the locking collar and pushed the button against the workbench. I matched the setting of the old switch (3 rings showing).
I also tested the switch on the bench as it has 3 pins but only 2 wires are used. The 3 possible pairs all work the same and the switch is not "keyed". Just plug the switch into the connector any way and then test it.
To reinstall the switch - With the locking ring unlocked, the switch reinstalls easily. Just push it in carefully to seat it. Then push a bit more so the locking ring snaps down to lock it in place.