I think it's just possible that Catholics who are in mortal sin may decide that by receiving Holy Communion, they will be a comfort to other grieving family members (especially their parents and grandparents), and so they work hard to find a way to receive the Sacrament of Reconciliation before they attend a funeral Mass.
Also, it's possible that Catholics in mortal sin may experience overwhelming grief emotions that make them want to be as united to their grieving family as possible, so they seek out a way to receive the Sacrament of Reconciliation so that they will be able to receive Holy Communion along with the rest of their family at the funeral Mass.
You may not notice that they got up very early that morning, or went in late the night before, for a Confession appointment with the priest.
And their contrition may not be perfect, but that is allowed in Reconciliation.
It's possible that God will be merciful to these Christians, because their motives were good. Perhaps this will be the start of an internal struggle that will eventually result in their repenting from their sin and returning to full fellowship with Jesus and His Church.
As for non-Catholics who receive Holy Communion at funeral Mass--yes, I definitely agree that the priest should make an announcement. But I know for a fact that many non-Catholics are in a state of shock and grief at funerals, and they don't pay attention to the announcement, or indeed, they don't pay attention to anything except their emotions over the death of their loved one. I believe that God will be merciful to these Christians, because their motives were not evil, but good--during a time of sorrow, they were trying to seek out Jesus for comfort.
Also, there are non-Catholics who do hear the announcement, but receive Holy Communion anyway because they disagree with Catholic theology, which they believe is in error. God will judge these non-Catholics according to His perfect knowledge of their souls, and we don't have to judge them. Pray for them, that their act may actually be the beginning of a conversion to Catholicism. I personally know people who were not interested in Catholicism UNTIL they attended a Mass and received the Holy Communion, and their act bothered their conscience and they knew in their hearts that they had received Jesus unworthily, and eventually, they sought out information about the Catholic Church and ended up converting.
Finally, there is a group of Catholics who have received incorrect teaching that at funerals, the "rules" are suspended and everyone is invited to receive Holy Communion. Again, an announcement by the priest might correct their thinking, but as I said, they may not even hear the announcement if they are too devastated by their emotions.
Always remember that people don't always behave rationally during funerals. Grief makes people do things that they would normally never do in public; e.g., crying, hugging, talking too much, not talking enough, etc. A lot of people say that they feel like robots during the days after the death of a loved one--they go through all the motions without even being aware that they are doing things. I think that some people receive Holy Communion because everyone else is going up and they just follow the crowd. Their grief is causing them to suspend rational thought and just behave mechanically. This is how many people survive the death of their loved one--their brain gets set on "automatic pilot" and they just do things without thinking.
Please be merciful to those who are grieving. Pray for them. And perhaps several months from now, when they are beginning to recover from their grief, you can talk gently to them about Jesus and the Church.
I hope all these ideas are comforting to you.