Well, this is as simple as anyone can make it.
Forward handing is when the point of release of the ball is beyond the yard line on which the player handing the ball is positioned at the time of handing. Any other handing is backward handing, just like any passing of the ball that isn't forward is backward (even if parallel to the yard lines).
Backward handing of the ball may be performed by any two players, any time, anywhere.
To legally perform forward handing, the handing may only be by Team A behind the NZ, and must be by a back to another back, or by a back to a lineman (regardless of the lineman's jersey number) ONLY if the lineman has left his position on the line (after the snap) and made a motion with both feet that faces him toward his own end line, and he is then at least 2 yards behind the NZ when the ball is handed forward to him.
The number worn by either the hander or the receiver is irrelevant to handing of the ball.