God doesn’t actively punish us, but when we separate ourselves we actually“punish" ourselves. This of course needs some explanation.
God is love. He loves us so much that he won’t force us to love him. So we have a choice whether or not we want to love him or not. But love is not a feeling or a proclamation. Saying“I love you" to someone is not enough: we must show it. If a married couple professes their love for one another every day, but every night the man has extra-marital relations with someone else, that isn’t love no matter how many times he tells his wife he loves her. So during this life our body and soul work together to do things that show we love God.
When we die, the body and soul are separated. The soul has no way of doing any activity to show its love or otherwise. So at the moment of our death, God will give us what we want: either he gives us himself, or he gives us ourselves. Hell is the condition where we are not with God. Instead we are left alone to ourselves – because that it what we wanted.
That sounds like joyful solitude. But in the Catholic mindset, we know we were made to be with God. So at death our souls, without the buffer of a body, longs to be with God who is the source of love. Our soul, that is a spirit that doesn’t die, craves for love. The ultimate source is God and we will be so attracted to God. So in hell, the souls suffer the pain of separation from God. But God did not inflict that pain on them: it is just a result of the choice they made.
If God is love, why doesn’t he just forgive us at death? He could, but that is his prerogative. With mercy, there is justice. Since God is good, he is also just. And with justice, every man reaps what he sows. In the case of God’s justice, it is not vengeful. Sometimes we will hear or read the word“punish" from Catholics and the context is always a self-inflicted“punishment" of the sinner.