Why do we need to pass through afflictions and persecutions?

We ourselves boast in you among the churches of God concerning your endurance and faith in all your persecutions and the afflictions which you bear,
A plain indication of the righteous judgment of God, that you may be accounted worthy of the kingdom of God, for which also you suffer.
(2 Thes. 1:4-5)

Establishing the souls of the disciples, exhorting them to continue in the faith and saying that through many tribulations we must enter into the kingdom of God. (Acts 14:22)

“The believers have been called into God’s kingdom and glory (1 Thes. 2:12). To enter into this kingdom, we need to pass through afflictions (Acts 14:22). Hence, the persecutions and afflictions are a plain indication of God’s righteous judgment, showing that we may be accounted worthy of the kingdom of God.”

(2 Thes. 1:5, footnote 2)