I heard the Messenger of Allah ﷺ say, "On the Day of Resurrection, a man will be brought and cast into the Fire. His intestines will spill out, and he will go around dragging them just as a donkey circles a millstone. The people of the Fire will gather around him and ask, 'So-and-so, what has happened to you? Did you not command good and forbid evil?'He will reply, 'Yes, I used to command good but not do it myself, and forbid evil while committing it myself.'"
سمعت رسول الله ﷺ يقول: يؤتى بالرجل يوم القيامة، فيلقى في النار، فتندلق أقتاب بطنه، فيدور بها كما يدور الحمار بالرحى، فيجتمع إليه أهل النار فيقولون: يا فلان، ما لك؟ ألم تكن تأمر بالمعروف وتنهى عن المنكر؟ فيقول: بلى، قد كنت آمر بالمعروف ولا آتيه، وأنهى عن المنكر وآتيه.
Bukhari related it in the Book of the Beginning of Creation (3267), and Muslim in the Book of Asceticism (2989), both through the route of Amash, from Abu Waail Shaqiq, from Usama bin Zayd, who mentioned it. The wording given is Muslim's, and Bukhari's wording is similar.