I do not dispute what the previous posts have offered - but there is an additional point that should be made concerning why Christ’s children sometimes receive “chastening”, or corporal discipline.
Hebrews 12:5-11 says that God chastens His children when they do wrong. That’s not talking about judgment in the world to come, but parental discipline in the here and now. He says that corporal discipline may not be pleasant while it’s happening, but it results in the peaceable fruit of righteousness - and it is a demonstration of the Father’s love. In fact, if you can sin and not be disciplined for it, then He says you’re not really a child of God.
Some examples of this can be seen in I Corinthians 11:29-32. Some of the Corinthians were partaking of the communion service even though they were not really in right communion with God or His people. Paul says that because of this, many of them were weak and sickly - and even worse! They were not examining themselves and judging their own sins. He says that if we would judge ourselves - leading to confession and repentance - we would not be judged. But he’s careful to distinguish that when God’s children are judged, they are being disciplined - just as Hebrews 12 said a loving Father would do to correct His own. They are disciplined in love rather than condemned in wrath with the lost of this world.
Notice how Psalm 119:67 says, Before I was afflicted I went astray, but now have I kept thy word. And verse 71 says, It is good for me that I have been afflicted, that I might learn thy statutes. And notice the psalmist’s humility in verse 75 - I know, O Lord, that thy judgments are right, and that thou in faithfulness hast afflicted me.
Finally, in Revelation 3:19, Christ warns the lukewarm Laodicean church, As many as I love, I rebuke and chasten - be zealous therefore, and repent.
So we cannot ignore the fact that the Heavenly Father will lovingly discipline His wayward children to set them back on the right path of life.
I hope these verses help you!