Reliable Interaction method with physics raycast

I’m designing a 3D third person game in which the player can interact with object when they walk up to them (within the collider) and press a button. I’m currently using physics raycast to detect interactable objects, but if I get too close or touch the object, it no longer detects it, making it very unreliable. How can I make it work 100% of the time.

Input controls, uses input system to call:

private void onInteract(InputAction.CallbackContext context)
    {
        if (active)
        {
            RaycastHit hit;
            var ray = new Ray(this.transform.position, this.transform.position);
            if (Physics.Raycast(ray, out hit, 100))
            {
                Interactable interaction = hit.collider.GetComponent<Interactable>();
                if (interaction != null)
                {
                    interaction.Interact();
                }
            }
        }
    }

The interaction function being called, can be overwritten by other scripts:

public virtual void Interact()
    {
        Debug.Log("Interact");
    }

If your raycast starts in the collider (like if you are touching it), then it will not detect it.
See this line from the Unity Scripting API:

“Notes: Raycasts will not detect Colliders for which the Raycast origin is inside the Collider.”

You could try originating the raycast from behind the player or from its back, as that will likely not be inside the collider.
Also, a couple of tips:

  1. Look at the Unity Scripting API. It is a very useful resource and can tell you all of the technical complexities and shortcoming of a function.

  2. You only have to use transform.position, not this.transform.position

Hope this helps