The trick is to convert the tree into an undirected graph. Run a DFS to record each node's parent. Now every node can reach its left child, right child, and parent.
Once you have parent pointers, run BFS from the target node. At each BFS level, expand to left, right, and parent (skipping already-visited nodes). When you reach level k, collect all nodes at that level.
This two-pass approach (DFS for parents, BFS for distance) turns a tree traversal problem into a straightforward graph search.