Raycast can not detect collider

My bullet can not detect the collider and raycast can not detect the collision. It’s very weird since the only way to get a message on the console is whenever I shoot bullets within the range of my terrain(either on or above), I instantly get “Terrain” printed on my console, but the raycast cannot detect any other objects and print anything, and if I go out of the range and shoot at a sphere, nothing gets printed.

void Update () {
    if (Input.GetKey(KeyCode.KeypadEnter) && counter > delayTime)
    {
        Instantiate(bullet, transform.position, transform.rotation);
        counter = 0;
        RaycastHit hit;

         if (Physics.Raycast(transform.position, -Vector3.up, out hit))
        {
               Debug.Log(hit.collider.gameObject.name); 
        }
    }

    counter += Time.deltaTime;
}
    }

Thanks!

If I were you, I would do this a little different.
Set your bullet’s collider to “Trigger” and give to your collider “OnTriggerEnter” void in which you will check if the Player has entered the bullet’s collider, if it has entered, then you can destroy the player.