Does using ranged vs non-ranged guns matter?

In all honesty, it's been a while - but from memory, my answer is No.

S.P.E.C.I.A.L pretty much sums up a lot of what goes on in the game, and while the wiki does not specifically link weapon types to any particular stat, weapon crafting does indicate that, in this particular example, crafting a rifle uses Perception, and crafting a shotgun requires Endurance.

This could suggest that giving a settler with more Endurance a shotgun would be beneficial over a rifle, and vice versa for a settler with a higher Perception, but again, there is no evidence of this in the wiki.

Additionally, combat does not guarantee who will be hit by what - "range" is sort of a pseudo statistic. Dwellers/Enemies will stand next to each other if they are using melee weaponry and attack that target they are in contact with. If a "ranged" dweller is in contact with one, that is their target, regardless of weaponry*. Otherwise they'll just "spread out" so you can see each individual dweller/enemy in the fight.

*Of course, dwellers wielding missile launchers, Fatmans and the like will just lauch AoE attacks rather than targeting individual enemies