The Messenger of Allah ﷺ used to teach them this supplication just as he would teach them a surah from the Quran. He would say, "Say, O Allah, I seek refuge in You from the punishment of Hell, I seek refuge in You from the punishment of the grave, I seek refuge in You from the trial of the false messiah Dajjal, and I seek refuge in You from the trials of life and death."
قال قرأت على عبد الرحمن عن مالك عن أبي الزبير المكي عن طاوس اليماني
أن رسول الله ﷺ كان يعلمهم الدعاء كما يعلمهم السورة من القرآن يقول قولوا اللهم إني أعوذ بك من عذاب جهنم وأعوذ بك من عذاب القبر وأعوذ بك من فتنة المسيح الدجال وأعوذ بك من فتنة المحيا والممات
Its isnad is sahih, and it is in Muwatta 1:216–217. Abu Dawud 1:566 narrated it from Qanabi, from Malik, and Munziri said, Muslim, Nasai, and Tirmidhi also reported it.