Slaughtering for the dead to get nearer to them and to glorify them is regarded as major Shirk (associating others with Allah in His Divinity or worship that takes the Muslim out of Islam), as a sacrifice must be offered to none but Allah. This is because Allah (Glorified and Exalted be He) says,
Say (O Muhammad صلى الله عليه وسلم): "Verily, my Salât (prayer), my sacrifice, my living, and my dying are for Allâh, the Lord of the ‘Alamîn (mankind, jinn and all that exists).
"He has no partner. And of this I have been commanded, and I am the first of the Muslims."
Allah (Exalted be He) says,
Therefore turn in prayer to your Lord and sacrifice (to Him only).
It was authentically reported that the Prophet (peace be upon him) said,
May Allah's curse be on anyone who slaughters (a sacrifice) to other than Allah!
It is not permissible to ask Allah's forgiveness for those who died as Mushriks (associating others with Allah in his Divinity or worship) or give money as charity for their sake, as Allah (Glorified and Exalted be He) says,
It is not (proper) for the Prophet and those who believe to ask Allâh’s Forgiveness for the Mushrikûn (polytheists, idolaters, pagans, disbelievers in the Oneness of Allâh), even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief).
(Part No. 1; Page No. 58)
As for the surviving people who offer sacrifices for the dead to get closer to them or to glorify them, they should be made aware of the ruling on such practices and should be advised in a nice way so that Allah may guide them to the right path. If they do not act upon such a ruling and insist on offering sacrifices for people other than Allah, they should be given three days to declare their repentance from this major sin. If they do not declare their repentance during the fixed three days, they should be killed as apostates from the religion of Islam.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.