When is the Queen useful?
Queens are very useful in the middle game and the endgame because they are very active. Queens are not powerful in the opening because it is dangerous to bring out your queen early (there can be opening traps where you will lose your queen). The queen will also be forced to retreat due to the minor pieces and pawns.
When is the rook useful?
The rook is most useful in the endgame, but can also be useful in the middle game. In the endgame there is a lot of space for the rooks to attack and defend unlike opening and middle game where the rooks will have to maneuver often. The rooks should stay on open and semi-open files during the middle game unless there is a really good attack where you will win.
In the position above, the white pawn is about to queen and its protected by the rook. The black rook is unable to get to the back rank in time. In the position below, you can see the squares the rook can move and the area it covers.