Building Quality Shaders for Unity®: Using Shader Graphs and HLSL Shaders (Apress publications)
has a section on making an “X-ray shader”. An actual HLSL shader is needed for built-in, but for URP you can use something called “renderobject” components in the scriptable render pipeline. I recommend the book for anyone who wants to do anything nontrivial with shaders: it describes how HLSL works in built-in and URP (but they say, use shader graph for HDRP, must be harder to write HLSL for that). It explains it in a way more easily understood than the web documentation. Note as of the more recent Unity versions, you can use shader graph with the Built-in renderer.
This unity doc illustrates a similar effect:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@11.0/manual/renderer-features/how-to-custom-effect-render-objects.html
I used a Fresnel (apparently pronounced “fruh-NELL” according to a Mythbusters episode, but I got in the habit of saying it as “FREZ-nell” when I first came across the word as a kid reading about optics) node on the “x-ray” shader graph material to turn it into an outline. Basically, renderobject can be set up so that when you are in front of opaque objects, the standard material is used, but the special x-ray material gets used for parts obscured. Layers are used to select which objects get this special treatment. The render queue is set to a value that is “in front of” all opaque renders, depth writing is enabled, and there is other stuff that I followed the written instructions on. I also had to adjust the render queue value for clothing and equipped weapons materials so there wasn’t an x-ray effect caused by that.