When you are in the overworld and run the command:
/execute as @s at @s in minecraft:the_nether if entity @s[distance=...1]
It returns "Test passed", but you are not in the nether.
But if you run (replace USERNAME with your name):
/execute as @s at @s in minecraft:the_nether if entity @p[name=USERNAME,distance=...1]
the test fails.
/execute as @s at @s in minecraft:overworld if entity @p[name=USERNAME,distance=...1]
works on the other hand.
Maybe the bug also exists in earlier versions but I haven't checked this.
duplicates MC-133579