“Yahweh is far from the wicked.” The second half of the verse shows how Yahweh is far from the wicked: He does not hear their prayers and thus does not answer them, but the righteous people who obey God have their prayers heard. There are a number of verses that say God does not answer the prayers of the wicked (cp. Job 35:12-13; Prov. 15:29; Isa. 1:15; 59:1-2; Ezek. 8:17-18; Mic. 3:4; Zech. 7:12-13; and James 4:3).
[For more on God not hearing the prayers of the wicked or honoring their sacrifices, see commentary on Amos 5:22.]
“he hears the prayer of the righteous.” The word “prayer” is singular while the word “righteous” is plural. God hears every prayer that a righteous person prays. This is an idiomatic sense of “hears,” and it means more than just that He hears the prayer, but that He hears it and pays attention to it.