Jesus took Peter, John, and James and went up the mountain to pray. While he was praying his face changed in appearance and his clothing became dazzling white. And behold, two men were conversing with him, Moses and Elijah, who appeared in glory and spoke of his exodus that he was going to accomplish in Jerusalem. Peter and his companions had been overcome by sleep, but becoming fully awake, they saw his glory and the two men standing with him. As they were about to part from him, Peter said to Jesus, “Master, it is good that we are here; let us make three tents, one for you, one for Moses, and one for Elijah.” But he did not know what he was saying. While he was still speaking, a cloud came and cast a shadow over them, and they became frightened when they entered the cloud. Then from the cloud came a voice that said, “This is my chosen Son; listen to him.” After the voice had spoken, Jesus was found alone. They fell silent and did not at that time tell anyone what they had seen.
Based on the passage, the experience that Peter, John and James have shows a glimpse of the future, and what is to come of Jesus. However, God also shows the glory and what will happen after Jesus suffers. With God showing all of this, it shows the disciples bearing witness to this majestic scene, continuing to follow Jesus and believing in his word.
In short, God shows that although this task will have pain and suffering, He will, in the end, guide us to eternal glory. God has a plan for all, and he will always take care of us.