“Do not take advantage of the widow or the fatherless. If you do and they cry out to me, I will certainly hear their cry." Ex. 22:22-23; but
“Do not follow the crowd in doing wrong. When you give testimony in a lawsuit, do not pervert justice by siding with the crowd, and do not show favoritism to a poor person in a lawsuit." Ex. 23:2-3; but
“Do not deny justice to your poor people in their lawsuits." Ex. 23:6.
To be clear, nothing is contradictory here. It, like e.g. the details about how to handle the death of an animal while in the care of a neighbor, just demonstrates a concerted effort to set the rules of justice out ahead of time. Before there are appeals to passion. But, at the same time, not to remove compassion from the law altogether. The latter is more illustrated in lending laws. For example, Ex. 22:25-27:
25 “If you lend money to one of my people among you who is needy, do not treat it like a business deal; charge no interest. 26 If you take your neighbor’s cloak as a pledge, return it by sunset, 27 because that cloak is the only covering your neighbor has. What else can they sleep in? When they cry out to me, I will hear, for I am compassionate.
The selection is not free of creepy stuff--Ex. 22:6 discusses the procedure for a man seducing a virgin, e.g. Also, we have the big version of the Promised Land again. Ex. 23:31
I will establish your borders from the Red Sea to the Mediterranean Sea, and from the desert to the Euphrates River. I will give into your hands the people who live in the land, and you will drive them out before you.