From Sahih Muslim (Hadith 1046):
Abu Huraira reported:The Apostle of Allah (ﷺ) said: When any one of you leads the people in prayer, he should be brief for among them are the young and the aged, the weak and the sick. But when one of you prays by himself, he may (prolong) as he likes
Reference: Muslim 1046