When a deceased is buried besides another being punished, does he see this and receive harm from it?
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
The affairs of the inhabitants of graves belong to the unseen in which there is no decisive opinion unless there is a proven revealed text in this respect.
But even, it is exhorted by the scholars, as stated by Al-Qurtubi and Al-Munaawi to bury the dead beside the righteous. This is supported by what is narrated in an authentic Hadeeth from the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, that, when he buried ‘Uthmaan ibn Math‘oon he placed a stone near his head and said: “By this I will recognize the grave of my brother and bury beside him those who will die from among my family.” [Abu Daawood; Al-Albaani: Hasan]
It is also reported that, when Zaynab, the daughter of the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, died, he said: “Join her with our good one who preceded us (to death), ‘Uthmaan Ibn Math‘oon.” [Al-Haakim]
Allaah Knows best.
You can search for fatwa through many choices