I heard Allah's Messenger (ﷺ) a hadith like this.

Sahih Muslim Book 54 Hadith 98

Sahih Muslim #2919 c

The Book of Tribulations and Portents of the Last Hour 54:98

Jabir b. Samura reported:

I heard Allah's Messenger (ﷺ) a hadith like this.

Chapter: The Hour Will Not Begin Until A Man Passes By Another Man's Grave And Wishes That He Was In The Place Of The Deceased, Because Of Calamity

Grade: Sahih