Layer in transform vs. Sprite Renderer component

Hello! I wanted to clarify that my understanding of Layers in Unity2D is correct. I’m trying to register colliders coming into contact, and I think the error lies in objects being in different layers.
I have layers for Background, Planets, and Units set up in the transform menu (user layers 8, 9, 10). I assign my planets to 9, and my units to 10. Any components in the object will know that object is in its respective layer, from what I understand. Eg my planet’s collider component knows the planet is in layer 9, since that is what transform is set to.
All of these objects have their own sprites, with a Sprite Renderer component. The Sprite Renderer also has its own Sorting Layer menu, where I’ve also set up Background/Planets/Units. This menu is only used for the ordering of sprites being drawn to the screen though, right? Any other components in my object have no idea what Sprite Renderer layer they are in, right? So for purposes of collisions and such, I’d want to make sure it’s the transform layers that are being set properly?
I tried to find an answer for this, but I’m probably not searching for the right terms. I’m sure this has been answered before. Thank you!

Yes, your understanding is correct. The “Layer” of an object is used generally for physics calculations and collisions, but can be used for other purposes too (for example you can tell a camera to only render certain layers). This is a property of the gameobject that the components are attached to, so any component wanting to know what layer it is on will see the layer of the game object that it is attached to.
**
Sprite Renderers have an entirely different property called Sorting Layer which belongs exclusively to the sprite renderer component and has nothing to do with the object’s Layer. The sorting layer is only used to determine the order in which sprites are rendered, which is useful for 2D games or UI’s but does not affect the physics system at all.

I figured out that my collision error had to do with lacking a Rigidbody, which has been fixed and it now works.
However, I am still curious to know if my understanding of the purpose of layers in transform or Sprite Renderer are correct.