Minecraft wiki entry for Creating_a_data_pack, associated text: In singleplayer, you can select your world, click on "Edit", then "Open world folder".
On a server, you can navigate to its root directory (where server.properties is located), then enter the world directory.