Kugel, “How to Read the Bible” (2007), does a short write-up in pp.471-472, in reference to the popularity of Ps 23 (via the KJV in America) at funerals, where it is understood to indicate something about life after death. The key phrases are “the valley of the shadow of death,” and “I will dwell in the house of the LORD forever.”
“Most contemporary scholars reject this understanding. To begin with, the ‘valley of the shadow of death’ seems to be a misreading (and misdivision) of the original Hebrew text: ‘a very dark valley’ or ‘valley of darkness’ is closer to what the psalm really says. And it does not say ‘through’ that valley; the Hebrew preposition means only ‘in.’ As for the psalms last verse, the words translated as ‘for ever’ really only mean ‘for a length of days’ or ‘for a very long time’. It seems more like a reaffirmation, rather than an extension, of ‘all the days of my life.’ (That is why most modern translations render this phrase not as ‘forever’ but ‘my whole life long’ or the like.) As for ‘the house of the LORD’, everywhere else in the Bible, this means the temple. One certainly could not be buried there and so dwell there after death: such corpse defilement would render the temple utterly unfit for God’s presence. Putting this all together, it seems that what the psalm originally meant was:
[Although things may at times be frightening, and] even though I might be walking in a dark valley, I will not be afraid…My only pursuers will be abundance and [divine] generosity my whole life long; and I will stay in God’s temple for a long time.”
Kugel cites W.L. Holladay, “The Psalms Through Three Thousand Years: Prayerbook of a Cloud of Witnesses” (1993), pp.359-361, both in this book, and in “The Great Shift: Encountering God in Biblical Times” (2017), where he says, “In sum, the book of Psalms is a collection (or more precisely, a collection of collections) written by different people and assembled from different sources and periods.” (p.135)
“Shadow of death” appears to enter translation from the LXX, “For even if I walk in the midst of death’s shadow, I will not fear evil, because you are with me” (NETS, 2007)–without the KJV’s valley.
As surprising as it may seem to modern readers, in ancient times, people were not necessarily scrutinizing every line of scripture for theological information. For example, among the Dead Sea Scrolls, only a few psalms receive commentaries or multiple citations. Psalm 23, like Psalm 22, is not cited at all. In 4Q171, 4Q173, and 1Q16, Pss. 37, 45, 127, and 68 appear, though these are not psalm commentaries in the modern sense: the commentary is a vehicle for the eschatological views of the community, and the citations serve the larger interpretation, rather than the other way around. (Wise, Abegg, and Cook, “The Dead Sea Scrolls,” 2nd ed., 2005, pp.249-253)