Is this the correct way to check it?

So I dont think there is needed the code.
The question is:
Is using OnTrigger functions to check if the player is grounded a good idea?
Im telling this because I saw a lot of people using LayerMasks but I dont have any idea of what is it.

It’s better to do a raycast pointing down 0.1 units long

if(Physics.Raycast(gameObject.transform.position, -gameObject.transform.up, 0.01f)
{
isGrounded = true
}