If one eats haram food, this will cause one’s dua to be rejected, hence it was reported in a hadith:
The Prophet (peace and blessings be upon him) said: “Allaah is Good and does not accept anything but that which is good. Allaah has enjoined upon the believers that which He enjoined upon the Messengers.” Allaah says (interpretation of the meaning):
“O you who believe (in the Oneness of Allaah — Islamic Monotheism)! Eat of the lawful things that We have provided you with, and be grateful to Allaah”
[al-Baqarah 2:172]
And He says (interpretation of the meaning):
“O (you) Messengers! Eat of the Tayyibaat [all kinds of Halaal (lawful) foods which Allaah has made lawful (meat of slaughtered eatable animals, milk products, fats, vegetables, fruits)] and do righteous deeds”
[al-Muminoon 21:51]
Then he (peace and blessings be upon him) mentioned a man who travels a great deal and becomes disheveled and covered with dust, who raises his hands to the heavens (and says), ‘O Lord, O Lord,’ when his food is haraam, his drink is haraam, his clothes are haraam and he has been nourished with haraam, so how can he receive a response?“.
(Source: https://sunnah.com/muslim:1015)
The meaning is that it is unlikely that his dua will be answered. But salah, will still be accepted, in the sense that it serves to fulfil his obligations, and he does not have to repeat it.