Genesis 38 is one of the most intriguing chapters in the book of Genesis. My own take of how to approach it, especially when it came to preaching the passage, has been to summarise the plot in Genesis 38 so:
“The plot revolves around the right of Tamar to be the mother of Judah’s heir.”
And then to consider and draw the parallels with this New Testament theme and its implication:
“The plot revolves around the right of the Spirit to be the mother of the heirs of the lion of Judah.”
Now clearly these are the big picture perspectives and you have to examine the details to see if it does justice to the Scriptures. But it did provide a useful platform for my own understanding of the passage in the book of Genesis and the wider bible. One thing is for sure – I do not believe, as some have argued, that the purpose of Genesis 38 is to highlight, through contrast, the faithfulness of Joseph (in ch 37) in the face of sexual temptation.