I’ve been at funerals where the person had not been a practicing Catholic. Some of these people had never been to Church in all the years I knew them. Why is it the Church buries these lapsed Catholics?
Often it is not clear why a lapsed Catholic has lapsed. The Church wants to fulfill the wish of Christ that all be saved. It is not proper for us to pass judgment on the spiritual state of others, particularly if we have not been with them during their last minutes of life.
Remember that at the last moment the good thief had a change of heart and Christ welcomed him into paradise. The parish priest or hospital chaplain will look for any indication that the individual wished to die on good terms with the Lord. Given that indication, the priest will not withhold any of the spiritual benefits that can be given the deceased and those close to him by a funeral Mass.