How to handle dodging when melee fighting?
You can still counter attack with the triangle button but you must time it perfectly and it will only work if your enemy doesn't have a melee weapon (you can't counter melee weapon bare handed). Otherwise, you'll get hit.
I think your best bet would be to not get in this situation into the first place by being cautious, keep a melee weapon like a brick, a bottle or a pipe, try to do combos like throwing and dashing in, or use the environment.