From a single-player game on a server. Stop the server, place the world folder next to the server jar, and enter its name in the field. level-name in server.properties. Start the server — it will open this world.
From the server to single-player. Stop the server, copy the world folder (its name is the same as level-name, by default world) in .minecraft/saves. The world will open in 'Single Player'. This is how a vanilla server world is transferred; Paper and Spigot separate the Nether and End into separate folders, and several folders must be transferred manually.