Make something happen when touch cube C#

I am very new to C# and scripting in general.
How would I make something happen when one object touches another object instead of just instantly?

OnCollisionEnter

OnTriggerEnter