与 here serves as a noun conjunction (you could replace it with 和), and links 世界 and 我 forming a composite subject. Its proper translation however depends on the verb that follows, which is 为.
为 oftentimes can be rendered just as "to be". It is after all a copular verb, especially in this sentence, therefore:
就算 / (世界 / 与 / 我) / (为 / 敌)
Even if it's me against the world
However, you should also consider that 与 can work as a preposition, thus it relates to the following 我 more strongly than "pure" conjunctions, so it's also acceptable to parse it as:
世界 / 与我
For this reason I would tend to give more prominence to 世界 semantically, therefore I think the best translation is:
Even if the world's against me