If you are using a grid and miniatures it is pretty easy, if another character is between an attacker and the target then the target gets cover, how much is a DM evaluation of the range, sizes of the creatures, etc.
If using theater of the mind, then the DM needs to be very descriptive about who is blocking/covering who. Given how the movement rules work in 5e it is pretty easy for a character to shift to the side, take a shot, then shift back in order to get around something in their line of sight so I generally only consider things near the target that might block line of sight, not things (other than a hostile enemy, perhaps) near the attacker.
A good rule of thumb is that if a creature is "in the way" somehow, grant the target a +2 to AC for half cover. I've been using this for ranged PCs shooting at a target in melee with another PC (and the PC is between the attacker and the target). I've been reserving 3/4 cover (+5 AC) for targets within structures, though I suppose a large animal (like a horse) in the line of sight of a medium target might also qualify.