I tested it on 3.4, 3.5 and 3.6 - same result everywhere, here's the .blend file
I have a two Render layers in my scene. One Layer have a Grease Pencil object with "Line Art" modifier that is pointing to a collection. With this two layers setup, I have a node tree in the compositor that have a Alpha Over node with those two layers connected and factor depending on "Greater than" of Depth (Z) passes of each render layer (See screen).
The problem is that if two objects that are in the line art collection, are too far away in the "depth" axis - the line art is drawn over the objects from another layer, even if it's further away. I made a simple scene that shows the issue, you can find it in the attachment
So - my question is - is this a bug or expected behavior? Is there anything I can do to prevent this behavior and make grease pencil to respect the Z pass as it does when the objects are close together?