These texts show opposite sides of the same coin. The fact is, all will enter into judgment with God, whether they served Him or not, whether they believed in Him or not.
In Psalm 7, David in the midst of persecution at the hand of his enemies displays his confidence in God’s ability to save, and acknowledges that there is a difference between himself and his persecutors. He is not claiming perfection, but David walked in integrity and righteousness, whereas his enemies did contrary to the will of God. God’s people look forward to the time of judgment, for the wicked will be brought to an end (verse 9), and the righteous saved (verse 10).
In Psalm 143, it seems David is overwhelmed by the trials he was enduring (verse 4). He calls to mind a time when he felt closer to God and stronger in faith (verses 5-6). Near the end of the Psalm, he is asking for revival in his life (verse 11). In a weakened place in his faith, David does not want to enter into judgment, for he realizes that none are righteous, not even himself. That is always the case—we are only able to stand in judgment because of Jesus Christ.
The difference between the texts is a matter of a strong, confident faith, versus a weakened faith. There is no contradiction.
A response to 1001 Bible Contradictions.