Rotation with Raycasting

WHen I rotate my raycast doesn't rotate as well. why not?

  transform.Translate(Vector3.forward * Time.deltaTime * speed);
    //transform.Rotate(transform.right * Time.deltaTime * 5);
    Debug.DrawRay(transform.position, Vector3.forward * 10, Color.green);

    if (Physics.Raycast(transform.position, transform.forward, distance))
    {
        transform.Rotate(-transform.up * Time.deltaTime * 150);
        Debug.Log("ToClose");
    }

Your raycast is rotating, but not the line that you are drawing. Try

Debug.DrawRay(transform.position, transform.forward * 10, Color.green);

(where Vector3.forward has been replaced with transform.forward).