UGameplayStatics class is meant for runtime code.
If you’d like to manage levels in the editor, you need EditorLevelUtils.
In my implementation, I keep an array of level names in the form of presets, so the user can easily switch between level presets. Then I retrieve ULevelStreaming* from the world (method in custom World Settings) and pass it to EditorLevelUtils methods.
This is ready snipper for you
https://gist.github.com/DoctorErgot/c98aa7fcb7ef7548338e24d950b8667c