That said, core D&D seems to be all over the place when it comes to weapons, technology, and mythology. (We have bronze age slings next too late medieval long bows. We have monster out Greco-Roman myth next to the clerics loosely inspired by medieval religious orders.) Therefore, fitting gunslingers into D&D could be done without too much problem. It would be a different type of fantasy, but it would not be any less "realistic" than the "baseline" assumption of D&D.
Just an observation: we have that kind of situation in the real world.
When the European empires were all over Africa, you had warriors with assegai and leather shields facing regiments with firearms...just as the American West featured Native Americans fighting gunpowder-wielding settlers and scouts with tomahawk, bow, club and javelin (at least at first).
Watch video of street fights in the Middle East of today and you can see people using slings in skirmishes with police or soldiers armed with submachine guns or even APCs & Tanks.
Just because a weapon is "obsolete" doesn't mean it disappears from the battlefield forever, all over the world.