The Japanese have many words for the word "world". However, they are not exactly interchangeable.
世界 "sekai" is commonly used for the physical world composed of the different countries and continents. In terms of nuance, it is related to 地球 "chikyuu", which literally means "the earth". Basically, 世界 can exist even without us human beings. Here are some real-life examples that come from some documentaries I've watched or from jisho.org.
sekai no chouten
top of the world
Sekai niwa nanatairiku ga aru.
There are 7 continents in the world.
Ai no chikara wa sekai wo ugokasu.
Love makes the world go round.
世の中 "yononaka", on the other hand, is used to refer to society instead of the "physical" world that 世界 is often used for. It is related to words like 世間 "seken" and 社会 "shakai", which both mean "society". (More on those two words later."
Yononaka wa semai mono desu ne.
It's a small world, isn't it?
Kare wa yononaka wo shouki ni modoshita.
He brought the world back to its senses.
It seems though that there is some overlap, based on example sentences:
Boku wa shinsekai no kami to naru.
I will become a god of the new world. (from Death Note)
References:"Essential Japanese Vocabulary" by Akira Miura
jisho.org (for the example sentences)