Stencil Shader With Depth?

I am super new to shaders and I need to basically be able to see through a large object where a mask overlaps it. I was able to achieve something like this with a stencil shader and URP RenderObjects Feature. But the problem is that, the stencil mask doesnt check for depth. I want to only be able to see the stencil mask, if it isnt occluded by anything.

What I have :

8aba57770b28dc778a10785ff5a2302032ddc304_2_517x499

What I want to have :

2e226c40d8e31863b1411c9df923e65ce6792224_2_525x500

Stencil Mask Shader :

Shader "Custom/StencilMask"
{
    Properties
    {
        [IntRange] _StencilID ("Stencil ID", Range(0, 255)) = 0
    }

    SubShader
    {
        Tags { "RenderType"="Opaque" "Queue"="Geometry-1" "RenderPipeline" = "UniversalPipeline"}

        Pass 
        {
            Blend Zero One
            ZWrite Off

            Stencil
            {
                Ref [_StencilID]
                Comp Always
                Pass Replace
            }
        }
    }
}

Render Feature :