If a PC is invisible, hidden, and within 5' of an enemy making a ranged attack:
If the PC wants to stay hidden, the PC has no effect on the enemy's ranged attack.
If the PC doesn't care about staying hidden, the enemy's ranged attack is at disadvantage and the PC's location is given away.
Same result if we flip the scenario around - if an enemy is invisible, hidden, and within 5' of a PC making a ranged attack:
If the enemy wants to stay hidden, the enemy has no effect on the PC's ranged attack.
If the enemy doesn't care about staying hidden, the PC's ranged attack is at disadvantage and the enemy's location is given away.