A number of commentators have noted that verses 23 and 24 of this Psalm speak of David's concern that his attitude towards his enemies (verses 19-22) would be corrected by God and that David would not harbor sin in his life. More about that tomorrow when I'll share some comments about verse 24.
Do you see what David was asking in verse 23? He wanted God to do a thorough examination of his life. He was showing the concern a dedicated believer has that there would be nothing lurking in their mind or heart that has not been made right with God. He was concerned with who he was and what he was prone to do. He knew that a "self-examination" was insufficient, no matter how one tries to look deep into their own lives. Only God can see us for who we really are. I like to say, "God knows us better than we know ourselves."
"Know my heart" speaks of where my deepest loyalties are based. Who or what really has captured the attention and affection of my heart? No one or nothing should have a more prominent place in my affections than my Savior. "Know my anxieties" speaks of what concerns are dominant in my life? This doesn't have to mean only "worries." This touches on "what matters most to me." There should be no concern of my heart that is more important than seeing God's will done. "Thy will be done" should be more important to me than any other decision I could make.
What do we do with the results of this exam? That's where verse 24 comes in.