Does using ranged vs non-ranged guns matter?
If I have a shotgun and a rifle of equal damage, they appear to fire at the same rate yet my settlers will often stand 'near' an enemy when using a shotgun, and sometimes move further away when using rifle.
Is it advantageous to prefer rifles over short range weapons, such as a shotguns as to be able to attack from a distance (and maybe distance yourself from an attack such as a petrol bomb) ?
Does getting hit interrupt your own attacks?
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