The big one that’s usually pulled out is magic. The idea is that magic and technology don’t play nice together. Dresden Files (and most of the Urban Fantasy/Paranormal Romance genre), Shadowrun, and Arcanum, all make use of this concept to varying degrees. It’s not that guns are technically no longer useful, it’s that they don’t work when faced with magic and thus magic users/fantasy monsters have no reason to use them/are incapable of using them. It’s an either/or situation.
Your characters are going dragon hunting or finding a troll in the sewers, then they probably aren’t going to bring guns with them. They’ll take an enchanted sword or any other necessary equipment for dealing with the threat. This will expand out to the mass majority of society. Your police officers will probably still keep their guns for dealing with non-magical threats, but may also carry a silver sword or whatever else they need to subdue the now magical threats their job requires them to deal with. You don’t actually need a special department for that either. It’s just that there are now psychics, telepaths, and magical knights on the Force. The major thread here is that people will adjust, society will adjust, and it will go on.
Also, if you don’t know that the cop you’re character is dealing with is a telepath, then life in general just got a whole lot more interesting.
This one is very common in the genre, though. One of the others is that magic was gone for a long time and society developed without it, then it returned. This skips out on having to explain how society developed without guns but also can lead to a more post-apocalyptic setting environment due to all your comforts (like cars and computers) no longer working.
You have Highlander, where it’s tradition. The sword is also the best way to ensure they get a clean beheading in their duels which allows them to take the other Immortals power. This doesn’t stop non-Immortals (and even some Immortals) from carrying or using guns, but it does mean you’ll most likely always see two Immortals dueling each other instead of using another alternative.
If you were wanting to excise just guns, then you’ve got a bit of a problem. The gun is directly related to technological and societal advancement. This includes the technological benefits that you are enjoying right now such as your computer, the internet, the car, and the socioeconomic changes of the past 400 years. The reason why feudal lords were able to keep control of their populations was because they had a monopoly on violence. The gun disrupts that monopoly. It creates a world where it no longer takes talent, training, or skill to kill a knight.
The British Empire. The United States. Colonialism in South America, Africa, India, the Middle East, and China, would all have looked very different, if it happened at all. Without guns, our modern world just isn’t the same.
I hate the butterfly metaphor from Chaos Theory, but the spirit of it holds weight here. You change one aspect of history and then, consequently, everything that hinged on it also changes. A good example of a narrative which explores this concept is Alan Moore’s Watchmen, if you read while having a solid understanding of American history/the Civil Rights era/the Vietnam War, etc, you can really see how the creation of Doctor Manhattan specifically changed the landscape of history. Starke suggested reading it with Where the Domino Fell by James Stuart Olsen and Randy W. Roberts, which is about Vietnam and American foreign policy after Vietnam. It’s a quick shot from 1945 to 2010. It’s also worth noting that Doctor Manhattan made the gun irrelevant, he also made nuclear weapons irrelevant and that endlessly perpetuated the Cold War.
I would read the comic before watching the movie because there’s a lot of little details that get lost, but if you really want to change history then I’d label Watchmen as required reading.
This is all me leading into to saying that whatever you do with your setting, it would be a good idea to start thinking about consequences. Not big consequences, the small every day consequences that lead into your sense of safety and security. Think about aspects of your life where instead of imagining “what would it be like if I had magic”, ask yourself “what would it be like if that person over there had magic and I didn’t”. What would life be like if we didn’t have a police force, or a fire department, or hospitals. Do you still go to the dentist when you have a toothache? Or do you visit the faith healer up the street instead? What proofing did the supermarket put in to keep the technomancers from screwing the barcode readers? Did the Department of Justice establish a special magic division? How does one keep telepaths and clairvoyants from cheating on their exams?
It’s questions about quality of life that usually result in the best worldbuilding. It’s not “what do I want it to be like”, it’s “if I changed this, what would be different?”, “what would the possible outcomes be?”, “how would people try to abuse the new systems?”, “how would other people stop them?”. The more questions you ask, the more answers you’ll find, then you can establish a sense of daily life in your setting which feels normal.