“For dogs encompass me; a company of evildoers encircles me; they have pierced my hands and feet— I can count all my bones— they stare and gloat over me; they divide my garments among them, and for my clothing they cast lots.” -Psalm 22:16–18
Dogs in the ancient world were scavengers. Much like buzzards that circle a dying animal waiting for it to expire so they can pick its carcass, dogs would bite and tear at the hands and feet of the nearly deceased—too impatient to wait for their prey to die. This is why Jews often referred to Gentiles as dogs. It was a pejorative term to describe their spiritual state as dirty scavengers in relationship to the Jews, the clean, civilized people of God.
Thus David metaphorically describes his weak and emaciated state as one pierced hand and foot by dogs as he awaits his imminent demise. And he describes his enemies as being these scavengers staring and gloating over him. Seeing him as good as dead, they impatiently tear at him as they wait to plunder his body and cast lots for his garments.
But once again, we must acknowledge the prophetic dimension of the Psalm. David’s poetic description of his own state of despair describes the events of the crucifixion of our Savior, Jesus Christ (e.g., Matthew 27:35). Jesus is the Son of David, the Root of Jesse, the perfect king who was pierced for our sake.