I don't think it's just ranged... Weapon damage seems super inconsistent on all weapons I've used. It goes over and under the min and max of what I thought determines damage; damage die + relevant ability modifier... I suppose there must be some resistances or other things in play... I have no experience with 5th edition and other editions mostly just from computer games... Armor is just AC that determines hits right?
The damage isn;t really that erratic or bugged when you think of it.
The damage model is based on 5e in which your damageoutput can fluctuate. A lot. Much more than traditional RPG's
Also in 5e it's very 'visible' what influences damages as you have a very transparent overview of what you're fixed minimum and maximum damage should be and how much dmaage you do.
However in BG3 you, as a player see, a lot of data which normally only would be visible to the DM, such as resistance, enemy HP, buffs etc.
In 5e you would do 12 points of damage to a monster, but you will most likely not know how much damage you actually did to a monster i.e.how much HP you've removed from a monster because only the DM knows that kind of info.
In BG3 you mainly see how much HP you;ve removed from a monster.
If your min damage on an attack is 6 and max damage is 12, that doesn't mean you can never hit lower than 6 or higher than 12 or that you always should hit 9 on average. Looking at buffs, debuffs resistances or weaknesses your damage output can be anywhere from 1 to 24 in that instance.
AC indeed determines wether you hit or not, which in BG3 is expressed as an percentage, based on Advantage, disadvantage and situational/environmental factors.
In D&D the chance to hit is based on a D20 and a fixed modifier based on either Strenght or Dex, depending on the weapon type and proficiency bonus.
Technically in D&D environment also plays a bg role, but it depends wholly on the DM how this is accounted for in terms of bonus or penalty.