In LOTR, you can see lots of fireworks, but then nobody uses cannons. A world with magic doesn't need to make sense technologically. You can fire a gun, throw fireballs or enchanted daggers. If the writer wants, all of those cause the same damage. Why? Because it's a fantasy world.
Those who don't know how to use a sword or cast spells can take a gun, but in this universe, lorewise, magic and enchanted weapons are usually much more powerful. Few main lore characters use guns, actually.