How to double check?

I have a trigger and a c# script that checks if the player left the trigger.
Everything works fine, but sometimes it glitches and says the player has left when the player hasn’t left.
How can I double check a OnTiggerExit?
Here is my code:

void OnTriggerExit(Collider collider){
	if (collider.tag == "Player") {
		//do something
	}
}

I’d try to address the “glitch” rather than trying to work with it. Typically if a trigger doesn’t fire correctly, it’s because your player object has a rigidbody and you are interfering with the physics calculation by directly setting the player transform’s position.

Here is an explanation of why this is: Rigidbody position