I see here in 10:1-18 two slightly different metaphors. Both involve shepherd imagery, and both involve clarifications about Jesus, but I don’t think they are directly about the same thing.
The first comparison, in verses 1-5, is about religion and deceiving teachers, whereas the second, from verse 7 to 18 is more directly about Jesus’ messianic ministry.
Following directly after the story of the healed blind man being cast out of the synagogue, it is easy to understand the first story. Jesus compares the Jews to a pen of sheep. Some of the sheep are His flock and they hear His words and recognize them. They convey truth. They follow Jesus out as their master. Others have come to the sheepfold with evil intentions. They try to wield power and influence over people. They are thieves and robbers. It is a harsh description, but applicable when one considers all the evils that have been done in the name of religion. People doing evil but claiming to please God and good.
As if in fulfillment of the parallel, the people who heard Jesus here did not understand what He was talking about. They did not hear His voice. If we consider the narrative unbroken from 9:41, Jesus was speaking to the very thieves and robbers He was describing.
In the second comparison Jesus’ words become even more difficult. Only His people will understand what He is talking about. Jesus claims that He is the only way into safety, into good pasture, into the Kingdom of God where mankind was intended to live. He is also the Good Shepherd. The Right, Noble, the True Shepherd. As in the first story, His sheep recognize His voice and follow Him. He calls them individually, by name.
Jesus doesn’t just love, care for, and defend His people. He lays down His life for His people. That is something that goes beyond the normal shepherd comparison. A good shepherd might be prepared to risk his life for his flock, but if he were to die defending them, what good would he have been to the sheep? But here, Jesus teaches that His true ministry to His sheep is to become a sacrifice for them.
In the first comparison, the pen was Judaism. Here, Jesus says that He doesn’t just have a flock within Israel, but He also has people amongst the Gentiles. Jesus dies for His people from all of humanity. Jesus laid down His life and died for our sins so that He could take it up again in victory over sin and death. He wasn’t killed, He sacrificed Himself.
As might be expected, these parables divided the crowd into those who heard and those who missed the point.