You're referring to Psalm 23, which begins with the famous line "The Lord is my shepherd, I lack nothing" (NIV). This psalm is indeed a well-known and beloved prayer, attributed to King David.
Regarding your observation, yes, some commentators have noted the potential irony or paradox of comparing God to a shepherd, given that shepherds do sometimes slaughter or eat their sheep. However, it's essential to understand the historical and cultural context in which this psalm was written.
In ancient Israel, sheep were a vital part of the economy and daily life. Shepherds were responsible for protecting, guiding, and caring for their flocks, which provided wool, milk, and meat for the community. While it's true that shepherds might occasionally slaughter a sheep for food or sacrifice, their primary role was to nurture and safeguard their flock.
In this context, the comparison of God to a shepherd is meant to convey a sense of guidance, protection, and provision, rather than exploitation or harm. The psalmist is emphasizing God's benevolent care and concern for his people, much like a shepherd's care for their sheep.
In fact, the Hebrew word for "shepherd" (ro'eh) carries connotations of guidance, leadership, and gentle care, rather than exploitation. The idea is that God, as the shepherd, provides for the psalmist's needs, leads them to green pastures and still waters, and protects them from harm.
Some commentators have suggested that the psalmist's use of the shepherd metaphor is meant to subvert the common understanding of a shepherd's role, emphasizing God's unique and loving character. By comparing God to a shepherd, the psalmist is highlighting God's commitment to the well-being and flourishing of his people, rather than their exploitation or harm.
So, while your observation is astute, the historical and cultural context of the psalm suggests that the comparison of God to a shepherd is meant to convey a sense of loving care and protection, rather than harm or exploitation.