So, we are supposed to judge the heart of the deceased? I always pray to Our Lady. If the person is lost, She will redirect the prayer to whom she sees fit. No prayer goes to waste. There are just some people whose condition at death you do not know.
Unless you are the strictest of Feeneyites and a staunch Jansenist, you don’t know for sure the person was a validly, practicing Catholic in the state of grace, don’t bother praying for them? Is it not better to err on the side of mercy rather than judgment?