How to detect for constant collision and then count how long the collision has been happening for?

Putting it simple, I am trying to make a grill, and when a gameobject is “on” (colliding with) the grill I want to give it a cooked rate.
I thought maybe I could detect when the collision enters and then start counting and incrementing the cook rate.
It would work like:
cookRate is less than or equal to 25, it’s undercooked.
cookRate is greater than or equal to 26, its cooked.
cookRate is greater than or equal to 40, it’s burnt.

I came up with this but I am not sure if this would work at all.

` int _cookRate = 0;

private void OnCollisionEnter(Collision collision)
{
	for(int i = 0; i < _cookRate; i++)
	{
		_cookRate++;
	}
}

`

float time; // The time you collied with something

void OnCollisionEnter(Collision other)
{
      time = 0;
}

void OnCollisionStay(Collision other)
{
       time += Time.deltaTime;
}

Yu can use a bool and timer like this :
bool IsColliding = false;
float timer = 0f;

void On CollisonEnter
{
IsColliding = true;
}

void On CollisionExit{
IsColliding = false;
}

void update{
if(IsColliding ){]
timer += Time.deltaTime;
// Do Your Stuff Here when Clollising is enable it will run otherwise not
}
}