I heard the Messenger of Allah ﷺ say, "Whoever obeys me has obeyed Allah, and whoever disobeys me has disobeyed Allah." He used to seek refuge from the punishment of the grave, the punishment of Hellfire, the trials of the living and the dead, and the trial of the false Messiah, the Dajjal.
أخبرنا محمد بن بشار عن محمد وذكر كلمة معناها حدثنا شعبة عن يعلى بن عطاء قال سمعت أبا علقمة الهاشمي قال سمعت
سمعت رسول الله ﷺ يقول من أطاعني فقد أطاع الله ومن عصاني فقد عصى الله وكان يتعوذ من عذاب القبر وعذاب جهنم وفتنة الأحياء والأموات وفتنة المسيح الدجال
Muslim narrated it in the chapter on the Book of Leadership, in the section on the obligation of obeying rulers in what does not involve disobedience and its prohibition in disobedience, hadith no. 33/1835, from Muhammad bin Bashshar with the same wording. It is also found in Kubra, hadith no. 07947.