The psalmist, David, is not aiming for moral perfection. In fact, he, of all people, would never claim to have it all together.
However, he is urging us to acknowledge that God places importance on both the external aspect (symbolized by 'clean hands') and the internal aspect (symbolized by 'pure hearts') of our lives, particularly when it comes to dwelling in His presence.
From time to time, I take an honest inventory regarding my 'hands' and my 'heart' before the Lord.
He never condemns, but He does correct. That’s what love does.
As a grateful son of a Good Father, I receive His correction from a redemptive, not punitive, place of love, mercy, and grace.
Is it time for all of us to take an inventory of our external and internal realities, so that we may ascend to the mountain of the Lord? - Pastor Jimmy