It doesn’t necessarily mean that only those people who go to church regularly are good people.
This was also confirmed by Pope Francis during his preaching in the chapel of Saint Martha residence in Vatican. He said that one shouldn’t be instantly considered a good man if they are just going to church on a regular basis.
Pope Francis preached this through the parable from the Gospel of Luke which is about the beggar, Lazarus and a wealthy man. The rich man, who was always dressed well and had a lot of food, ignored the suffering, the famine and illness of Lazarus.
The wealthy man was very religious and always generous to the church. He prayed regularly, donated to the priests and offered sacrifices to the temple. But Pope Francis said that these good deeds were no important at all when he couldn’t see and have mercy for his poor neighbor Lazarus.
However, not being able to see how much the people around you are suffering is not only slightly sinful but is a deep sinful state of the soul.