The Messenger of Allah ﷺ used to teach his companions, when they went out to the graveyards, to say, "Peace be upon you, dwellers of these abodes from among the believers and the Muslims. We will, Allah willing, be joining you. You have gone ahead of us, and we will follow. We ask Allah for well-being for us and for you."
حدثنا محمد بن حميد أبو سفيان عن سفيان عن علقمة بن مرثد
كان رسول الله ﷺ يعلمهم إذا خرجوا إلى المقابر يقول السلام عليكم أهل الديار من المؤمنين والمسلمين وإنا إن شاء الله بكم للاحقون أنتم لنا فرط ونحن لكم تبع فنسأل الله لنا ولكم العافية