My go-to rule with attack rolls is whoever wins hurts the other. This goes even with ranged attacks. Two gunslingers fire at each other, whoever wins hits the other.
The only time a ranged attack wouldn't risk a counter-attack is when the defender doesn't have a ranged weapon to defend with.