as long as its in the same generation of pokemon, then yes you can trade/battle with anyone from that gen,
Ex. so if you buy Sun or Moon (Gen7), you will be able to play with ppl with Sun and Moon, but not XY Omega Ruby Alpha Sapphire(Gen6)
2DS XL is more of an upgrade on the door stop that was the 2DS. the original 2DS was made for literal children whose parents didnt want their kids getting headaches from "3D"
I'm actually interested in the 2DS XL because it looks asthetically pleasing.