When the Messenger of Allah ﷺ wanted to sleep while in a state of major ritual impurity, he would perform ablution as he did for prayer. When he wanted to eat, he would wash his hands and then eat.
حدثنا محمد بن بكر قال أخبرنا يونس قال حدثني ابن شهاب عمن حدثه
كان رسول الله ﷺ إذا أراد أن ينام وهو جنب توضأ وضوءه للصلاة فإذا أراد أن يأكل غسل يديه ثم أكل