In the twelfth chapter of John, Jesus is trying to prepare his disciples for his upcoming death. He explains that the work he was sent to do as the man Christ Jesus was coming to an end, and for that work to be fruitful, he must die (John 12:24).
He also tells them that he is a light that was sent into the world and was about to leave the world in darkness. But those who believe in him would not be in the dark but children of light (John 12:35-36).
In verse 32 Jesus speaks of being “lifted up.” This signified that he was to be hung on a cross. Remember Jesus’s words in John 3:14-15 (NKJV), “And as Moses lifted up the serpent in the wilderness, even so must the Son of Man be lifted up, that whoever believes in him should not perish but have eternal life.” Jesus was referencing the time when Moses put a copper serpent on a pole and lifted it up so that anyone who had been bitten by a serpent could look upon it and be cured. (Numbers 21:8-9)
How could the perfect man Jesus be symbolized by a serpent? 2 Corinthians 5:21 (CSB), “He (God) made the one who did not know sin to be sin (pictured by the serpent) for us, so that in him we might become the righteousness of God.” Thus, Jesus’s death on the cross would be enough to bring all of humanity unto him and to be a cure from the power of the serpent (Satan).