You can also double melee them, that's viable in close quarters.
Taking cover at mid range is important too. Chances of them hitting your head with hip fire are super slim at that range and you can pick them off with hand-damage pretty easily.
I've never had this work as the shield just bashes me right after my first melee attack knocks his shield away. Knocking their shield aside should disable a shield's melee attack for like 1 second IMO.