It is narrated from Ata who reports that the Prophet ﷺ heard a man saying: "I am present on behalf of so-and-so." So the Prophet ﷺ said: "If you have performed Hajj before, then say Labbaik on his behalf, and if not, then first perform Hajj for yourself."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 924