How would I use other without it being a collision script

I’ve seen people use “other” as a way to refrence the object the collider is colliding with but how would I use that in my raycast script?

using UnityEngine;
using System.Collections;

public class CameraControll : MonoBehaviour
{
    Vector3 Campos;
    public Transform player;
    public GameObject Player;
    int count = 0;
    public float Distance;

    public void Update()
    {

        RaycastHit hit;
        Ray LandingRay = new Ray(transform.position, Vector3.forward);
            if(Physics.Raycast(LandingRay, out hit, Distance))
        {
            if(hit.collider.tag == "wall" && transform.position - transform.position.out) // how would I put other in here
            {

            }
        }

        if (Input.GetKeyDown("q"))
        {
            count++;
        }
        else
        {
            if (Input.GetKeyDown("e"))
            {
                count--;
            }
        }
        transform.position = Player.transform.position + Campos;
        transform.LookAt(player);


       
    }

    public void LateUpdate()
    {
        if (count == 0)
        {
            Campos = new Vector3(0f, 5f, -7f);
            Debug.Log(count);
        }
        else
        {
            if (count == 1)
            {
                Campos = new Vector3(7f, 5f, 0f);
                Debug.Log(count);
            }
            else
            {
                if (count == 2)
                {
                    Campos = new Vector3(0f, 5f, 7f);
                    Debug.Log(count);
                }
                else
                {
                    if (count == 3)
                    {
                        Campos = new Vector3(-7f, 5f, 0);
                        Debug.Log(count);
                    }
                    else
                    {
                        if (count <= -1)
                        {
                            count = 3;
                        }
                    else
                        {
                            if (count <= 4)
                            {
                                count = 0;
                            }
                        }
                    }
                }
            }
        }
    }
}

just a guess but
GameObject other = hit.colider.gameObject;

Depends how you want to use it.

if(hit.collider.tag == "wall" && (transform.position - hit.collider.transform.position) <= 1)