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