For starters Nadal is four years younger than Federer so age does play a role. Also, although Nadal leads in head-to-head matches 23-15, 13 of those wins came on clay where Nadal is very much at home and is the best on that surface. If you take clay court matches out of the mix, Federer has the advantage of 13-10 in head-to-head matches.
I think it’s clear that the top two players of all-time are Roger Federer and Rafael Nadal. At the moment I see Roger as the greatest of all-time. As both players are still competing for things could certainly change, but for that to happen, I think Nadal needs to prove his head-to-head dominance on hard/fast surfaces.