It should be noted that according to the Qur'an, those who will be the greatest losers in the afterlife and on the Day of Judgment are those who followed a religion other than Islam, as no other religion will be accepted except Islam.
The Prophet said in this regard: "The first thing that will be judged among a person's deeds on the Day of Resurrection is the prayer. If that is in good order, he will pass the test and prosper, and if that is defective, he will fail the test and will be a loser.
Regarding their good deeds, no weight will be assigned to them on the Day of Judgment. The point is that they thought they were doing good, but since they did not believe in Allah, their good deeds are futile. See the videos: