How to detect if an 2D sprite is stand on the ground

I use ray cast to perform that as the following

var position = transform.position;
            RaycastHit2D hit = Physics2D.Raycast(new Vector2(position.x, position.y), -Vector2.up, 0.1f,6);
            Debug.Log(hit.distance);
            if (hit.distance<0.1f){//do sth}

My ground layer is 6, what’s wrong with this one such that it always debugs to 0 distance (even if I was flying), did it collide with the character? The character doesn’t in the same layer as the ground anyways. I also tried to lower the center, doesn’t work either. How can I detect it correctly?

I believe this is relevant to your situation above:

Layers vs Masks: