I don’t think the lesson of Psalm 38 is meant to be a clear-cut “1. Bad things are happening to you because you sinned, 2. Confess your sins and the bad things will stop happening.” I say this because the psalm itself doesn’t have much clear-cut about it. The suffering the psalmist experiences is ambiguous in its source. It starts out as a result of God’s wrath toward sin but without announcing it, becomes stimulated by enemies who want to kill and harm without cause and the psalmist is once again seen as an innocent victim (verse 20). I think the lesson or point of this psalm is to once again guide us to run to God’s mercy and grace when we are experiencing suffering, even when the suffering continues. A unique feature of this psalm is its reminder to us that God’s wrath is real, so how much more should we 1. do our best not to sin, and 2. run to Jesus for his grace and forgiveness to cover our sin and satisfy God’s wrath. Once you are a Christian / believer, this is a once-and-for-all covering. Jesus’ work is finished. But it’s healing and freeing to remember what it is we deserve from God (apart from Jesus) so that we can so much better enjoy and experience his undeserved gifts of grace and mercy that he lavishes on us. When we start acting like God could never be wrathful because he’s just not like that (though Scripture says otherwise), we lose out on how big of a gift his mercy and grace to us really is.