Jesus explains his purpose in vv. 31-32: If you accept his truthful exposure of your sin and accept the truth about Jesus, you will be set free from your sin.
Holding to Jesus’ teaching (v. 31) not only establishes the genuineness of one’s faith, as D. A Carson points out, it also has its own authenticating power.
We come to know the truth, not simply by [(1)] intellectual assessment, but by [(2)] moral commitment (cf. notes on 7:17). (Carson 348)
But (v. 33f), if you reject the truth, there is no hope for being set free. They would do anything to convince themselves that Jesus’ truth is not ultimate truth.
Vv. 34-40show us how deceived we can become about our sin. The Day of Atonement which had just passed should have reminded them they were sinners. Because they were still in bondage to sin, they were slaves and not sons regardless of their descent and had no hope for ultimate and final liberation apart from the Son.
They thought they were safe because they were sons of Abraham. I meet many people who respond to questions about their spiritual condition by telling me how often their grandmother went to church or how devout their grandfather was. That’s like saying your grandmother raised 15 children therefore you are an expert in child-rearing.
They said this yet they were trying to kill the Son of God who (39-40) was himself a son of Abraham which served as proof they were not true sons of Abraham (39) nor of God (42).
The exchange gets more heated and direct in vv. 41-47. Jesus points out that they were instead sons of the Evil One, the Devil. This is demonstrated by their actions which are the same actions the Devil himself does. The work they do, lying about Jesus’ true identity and seeking to murder him, are the works of the Devil, who was a liar and a murder from the beginning (44). This demonstrates that they are not of God (47).
[48-52] They accuse him of being demon-possessed and a Samaritan (the equivalent of a “half-breed heretic”) (48). Both of these are statements of gross disrespect which Jesus rightly takes as an attack upon his honor and the honor of the Father (49). The Father, the ultimate Judge, will judge them for this (50). The promise not to see death is a promise that goes beyond this world; the promise that the one who believes in Jesus will transcend death (51).
The exchange in vv. 53-58 brings the whole situation to a head. The rabbis believed that Abraham had been given a vision of the age to come and the fulfillment of the promise made to him. This is what Jesus refers to in v. 56. Jesus’ claim to have seen Abraham is an implicit claim to deity (57) and the use of “I AM” (58) is an explicit claim to deity.
 Jesus’ “hour” was not yet (cf. 20) and would be fulfilled in the Father’s time so Jesus was enabled to pass through them and avoid execution.
Now what does this have to do with us? We are set free not by pretending that what Jesus says isn’t true or by explaining away who he is and what he has done, but by accepting the truth about our sin and the truth about who he is and what he has done.
The Ultimate Judge will one day evaluate us (50) and nothing will spare us from his wrath except his grace and the sacrifice of his Son. Apart from that grace and Jesus’ work, this world is the best you can hope for. But if you believe in Jesus, even death holds no triumph over you because you will triumph over it just as you Savior did.
If you are reading this and have not yet accepted Jesus’ truth about yourself and about himself and his work you must do so today. There is no hope apart from Jesus Christ. You are a sinner and that sin has separated you from God and only what Jesus Christ did in dying in place of sinners can reconcile you to God.
If you are a believer, humble yourself before the truth of God and let him expose your sin. Unlike many people who confront you about your sin, He is not trying to make himself superior (he already is), nor is he trying to make you inferior (you already are); he is trying to prepare you for heaven. He is working to make your outside life line up with the state of your soul, and he is preparing you to live forever with him.