Is there a way to access the dimension a command is being run in?

I'm currently relying on NBT data to do this (eg. data get entity @s Dimension), but that doesn't work with execute in datapack:dimension or if the command is being run by the server. Is there a way around that or do I just have to live with the fact that my commands won't work in those situations?
Continue to help post