I agree with the "neither/both" answer.
For me it's important to set the big rules early. Technology level, how magic works, the rough outline of the world, races, etc. Those make up the canvas I can paint my story on. Things that are more or less fixed through the story.
Afterwards I write my story and expand the world whenever I need it. Need another city in the world? Let's find a good place for it. Need a different race or a new nation? Let's find a place for it. Most stories shouldn't start with endless amount of info-dump about the world, so all those details were probably never mentioned before anyway. As long as I don't break the "big rules" and change the feeling of the world with that, it doesn't really matter...
And if you set up those bit things early and add details as you go along, those small details will feel planned out as well. To the reader it won't matter whether they were made up in that minute or planned out months in advance. As long as it fits into the world itself, it makes no visible difference.