Offering udhiyah is a highly rewardable act of worship. Those who are able to offer it are even required to do so on behalf of their household and their dependents. This may even be extended to the dead ones.
Regarding this question, we quote Sheikh Muhammad ibn Al-‘Uthaymeen, who said,
Basically, udhiyah is prescribed for living persons. The Messenger of Allah, Prophet Muhammad (peace and blessings be upon him), and his Companions used to offer the udhiyah on behalf of themselves and their families. There is no basis for what some laypeople’s believe that the udhiyah should specifically be offered on behalf of the dead.
there are three types of offering udhiyah on behalf of the dead:
1. Offering udhiyah on their behalf together with the living ones, such as when one offers udhiyah on behalf of him- or herself and the members of his or her family, intending thereby both those who are alive and those who are dead. This type is permissible. The basis of that is the fact that the Prophet (peace and blessings be upon him) offered udhiyah on behalf of himself and the members of his family while some of them had previously died.
2. Offering udhiyah on behalf of the dead in fulfillment of their will. This is obligatory unless one is unable to do so. The basis for this is the verse in which Almighty Allah says,
(If anyone changes the bequest after hearing it, the guilt shall be on those who make the change, for Allah hears and knows all things.) (Al-Baqarah 2:181)
3. Voluntarily offering udhiyah on behalf of the dead independently of the living, such as offering a separate udhiyah on behalf of one’s late father or mother. This is permissible. The Hanbali fuqaha stated that the reward for that will reach the deceased and benefit them, making this case analogous to giving charity on behalf of the dead.
However, we do not think that singling out an udhiyah for the dead is Sunnah-compliant, because the Prophet (peace and blessings be upon him) did not offer udhiyah specifically on behalf of any of his deceased, beloved ones — he did not offer udhiyah on behalf of his paternal uncle Hamzah, even though he was one of his dearest relatives; or on behalf of his children who died during his lifetime, who were three married daughters and three sons who died as infants; or on behalf of his wife Khadijah, who was one of his most beloved wives. Moreover, it was not narrated that any of his Companions offered udhiyah on behalf of any of their deceased beloved ones.
May Allah guide all to what pleases Him!