In these verses, Jesus has just been betrayed by Judas. The temple guards and the chief priests come with Judas and are going to arrest him. Some of Jesus’s disciples want to defend him and one (identified in John as Simon Peter) strikes off the ear of the chief priest’s servant with a sword. In Luke, Jesus first rebukes his own disciples for their violence and then heals the servant’s ear.
Jesus then turns to the people who have come to arrest him and rebukes them. He says that they are coming after him as if he were a rebel (or, in other translations, a thief). He criticizes them for coming after him armed as if he were some dangerous person. He tells them that they know him and that he has been preaching in the temple (as seen, for example, in Luke 21:37). He points out that they never did anything to him then and he rebukes them for now acting as if he is dangerous and deserves to be arrested.