A rook attacks a piece through a defender, or supports its own piece through another. The line matters even when blocked. You miss the pattern both ways.
vs game: white rook on the same file as black's rook, with a white pawn between. The pawn falls, the rooks trade, white wins a tempo.
vs puzzle: queen x-rays a king through a defender. Capture the defender, mate next.