In Psalm 37 we read the confidence in the moral order of things that we’ve seen questioned in Job. The righteous prosper and the wicked perish, and the psalmist insists that this is apparent to all. Job might have seen this differently, and it may look different to us much of the time, but there’s a place for this confidence, as a foundation for living by God’s ways. Even if we have to defer justice into the final judgement, we need to know that God sees and cares, that he will put things right.
But we know that this isn’t the whole story, and that the world isn’t always that simple. The psalmist’s experience doesn’t set a universal pattern, but expresses the prayer we can offer when life does follow the rules.
We could say the same of Psalm 38 – the psalmist is clear that his suffering and illness is caused by his sin, and in the midst of his pain he pleads earnestly not for healing but for forgiveness. This may have been his experience – and when ours matches his, then we have words ready for our prayers. But it doesn’t mean that all suffering is the result of sin, or that we are to blame for our own illness. Perhaps in all their variety the psalms work better for giving us words to express our experience and feelings than they do for setting the terms of reference within which we ought to feel and understand the world.
Because something is in the Bible does not mean that it is universally applicable. The psalms are a resource for prayer, not a book of systematic theology.