To do righteousness and justice
is preferred by Yahweh over a sacrifice. Bible see other translations

“righteousness and justice.” Living a righteous and just life takes humility and discipline. Life is not fair or nice, and the godly suffer persecution (2 Tim. 3:12), yet they are required to bear up under it without becoming resentful or bitter. Being “religious” and offering external things like prayers and sacrifices does not require clean, godly hearts; that is clear from the many ungodly priests of Israel who did the duties of the Temple. Jesus compared the religious leaders of his time to whitewashed tombs that appeared clean on the outside but inside were full of dead people’s bones and were full of uncleanness (Matt. 23:27). There are many verses in the Bible that are much stronger than this one about God not accepting the sacrifices of the wicked. Proverbs 21:27, later in this chapter, is one of them. [For more information about God not hearing the prayers of the wicked or accepting their sacrifices, see commentary on Amos 5:22].

Commentary for: Proverbs 21:3