Keep A game Objects Collider inaccessible behind a UI Image

I have a Cube with a collider and a simple script that says you clicked the cube.

    public void OnMouseDown()
        Debug.Log("You Click the cube");

The Cube’s Z axis is set at 10 so it is currently behind two Images that occupy the canvas space.

In what way could I make the Cube inaccessible to select behind lets say the image on the left labeled “Yellow Image” yet retain the ability to select it if you select the half behind the image on the right.

As of now I tried to add an additional camera in which I added the Cube to the Culling Mask and removed the cube’s culling mask from the main camera, which did not work regardless of depth of either camera. I am sure there is a quite simple solution, I just can’t seem to grasp it. Any help is appreciated.