I'm trying to remember a YA Sci-Fi book, probably from the 2000s, about a boy who is randomly attacked by what looks like wizards and robots. He is then saved by someone who appears to be an older version of himself and taken to another dimension which is almost identical to his own.
He learns that these worlds are created from choices; one choice creates one world, and the other choice creates another. Eventually, they fall into a spectrum with magic being at one extreme end and science at the other. Both extremes are trying to take over the other Earths in between. The only one who can travel between the worlds is that world's version of himself.
There's the older him, a girl him, a werewolf him, and an old man him. Basically, all the versions of him are gathering to try to stop this conquest. The magic and sci-fi empires hate each other. At one point, it's revealed that each empire is able to travel between worlds by kidnapping hundreds of versions of this one guy and using them like a battery.
The protagonist we follow tries to leave at one point and has his memory wiped, but then remembers everything because of a floating ball 4th dimension sidekick character whom he befriended while walking through the 4th dimension between worlds.
I think there are more books in the series, but I just read the one.