Buraidah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "(In the past) I forbade you from visiting graves, but visit them now."In another narration Messenger of Allah (ﷺ) said, "Whoever wants to visit a graveyard, let him do so, because it reminds us of the Hereafter."[Muslim].
App reference: Book 1, Hadith 582
Arabic/English book reference: Book 1, Hadith 581