All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
If you are deputized to slaughter a sheep, then it is not permissible for you to contravene what you were deputized to do and distribute food or anything else instead; rather, you are obliged to do exactly what you are deputized to do, so you should buy a sheep and distribute it to the poor.
Ibn Hazm said: “It is not permissible for a Wakeel (agent) to contravene what his Muwakkil (the person who deputized him) ordered him to do....”
In case you buy the food instead of the sheep, the contract is valid but its effectiveness depends on the Muwakkil if he/she agrees to it, so if he/she agrees, it is effective, otherwise the food becomes yours and you have no right to ask the person who deputized you for the price of the food.
However, the fact that the people need food more than meat is not a sound reason for contravening (what you are deputized to do) and you may inform your friends who volunteered to pay for the meat that the people need food more than meat and so they may deputize you at the first place to buy the food and distribute it instead of meat.
Allaah Knows best.