Best way for ground detection without ground check?

I am trying to make a procedural survival game. I followed the tutorial and it uses a character controller I don’t really like. So I am trying to use a custom player, but they all require a ground check for jumping and better gravity. I found a code snippet from the original controller
private float checkDownSpeed (float downSpeed) {

        if (
            world.CheckForVoxel(transform.position.x - playerWidth, transform.position.y + downSpeed, transform.position.z - playerWidth) ||
            world.CheckForVoxel(transform.position.x + playerWidth, transform.position.y + downSpeed, transform.position.z - playerWidth) ||
            world.CheckForVoxel(transform.position.x + playerWidth, transform.position.y + downSpeed, transform.position.z + playerWidth) ||
            world.CheckForVoxel(transform.position.x - playerWidth, transform.position.y + downSpeed, transform.position.z + playerWidth)
           ) {

            isGrounded = true;
            return 0;

        } else {

            isGrounded = false;
            return downSpeed;

        }

    }

I then asked many more questions but not getting the right answer. I need a way to use raycasts or any thing other then Ground check or ground layers. The github: Code-A-Game-Like-Minecraft-In-Unity/06-character-controller at master · b3agz/Code-A-Game-Like-Minecraft-In-Unity · GitHub. In chunk.cs there is no monobehaviour there is one in world.cs but when i apply int LayerIgnoreRaycast = LayerMask.NameToLayer("Ground"); gameObject.layer = LayerIgnoreRaycast; Debug.Log("Current layer: " + gameObject.layer);. It does not work. Thank you.

what do you mean it doesn’t work? do you get an error? ground check is not one thing, anyway to check the ground under your character is a ground check, so what you need is a different way to do it, there are multiple ways to do it in unity, here is a video on three ways to do it and I also have 2 more ways not in this video:

1 -
private void OnCollisionEnter2D(Collision2D collision)
{
    isGrounded = true;
}

private void OnCollisionExit2D(Collision2D collision)
{
    isGrounded = false;
}

2 -

isGround = footCollider.IsTouching(groundCollider);

This is all for 2d, but they all have a 3d version except is touching.