Let's be very clear, "magic" exists in StarTrek, too: Q is literal god-level magic. There are telekinetics, empaths, and hiveminds. At least one species has the capacity to mentally create realistic illusions taken from a subject's mind, while others will keep you trapped in your own nightmares for what feels like centuries. Hologram programs are solid and are, multiple times, shown to have the capacity to achieve sapience. In star trek, the magic follows rules. Usually not very well-thought-out, but the feeling that there is an explanation behind any phenomenon is the core conceit of the "exploration" fantasy of Star Trek.
So, saying "in a universe where magic exists" belies the real difference: "in a story where the explanation of phenomena is not a priority, only the spectacle and metaphor of the phenomenon matters."
The giant space lasers are never explained, because their explanation would not suit the desires of the storytellers.