Six British clubs found out their opponents for the group stage, which begins on September 12 and 13, in the draw in Monaco on Thursday.
Premier League champions Chelsea were drawn in Group C alongside Costa’s former club Atletico.
Costa joined Chelsea from Atletico in July 2014 and has been an unauthorised absentee from London this summer as he agitates for a move back to his former club. The situation is complicated by a transfer embargo which prevents Atletico from registering new players until January.
Roma and Qarabag, the first Azerbaijan side to reach the group stages, are also in Group C.
Tottenham, runners-up behind their London rivals in May, face the unenviable task of facing holders Real Madrid and Borussia Dortmund in Group H, as well as Cyprus’ APOEL.
Scottish champions Celtic, play-off winners over Kazakhstan’s Astana, are also in a challenging pool, against Bayern Munich, Paris St Germain and Anderlecht in Group B.
Five-time winners Liverpool, who advanced via the play-offs with victory over Hoffenheim, will play Spartak Moscow, Sevilla and Maribor in Group E.
Chelsea are the most recent champions from Britain after lifting the trophy in 2012.
The final takes place at the NSK Olimpiyskyi in Kiev on May 26, 2018.
Real Madrid won Europe’s elite club competition in Cardiff in June, becoming the first team in the Champions League era to win back-to-back titles.
Their draw with Tottenham reunites Gareth Bale with his former club.
The draw was made at the Grimaldi Forum in the Principality by Francesco Totti and Andriy Shevchenko, the former Chelsea striker and an ambassador for the 2018 final in his native Ukraine.
Teams from the same association cannot face each other in the group stage.
It is only the second season that five clubs from one nation were in the group stage, after Spain had five representatives in 2015-16.
Chelsea return to the competition after a season’s absence after winning the English title under Antonio Conte.
Manchester United are back under Jose Mourinho, a Champions League winner in 2004 with Porto and 2010 with Inter Milan, after being knocked out on in the group stage in 2015-16.
Just two groups featured non-British teams.
Group G features Monaco, Porto, Besiktas and RB Leipzig.
Draw in full
Group A: Benfica, Manchester United, Basel, CSKA Moscow
Group B: Bayern Munich, Paris St-Germain, Anderlecht, Celtic
Group C: Chelsea, Atlético Madrid, Roma, Qarabag
Group D: Juventus, Barcelona, Olympiakos, Sporting Clube de Portugal
Group E: Spartak Moscow, Sevilla, Liverpool, Maribor
Group F: Shakhtar Donetsk, Manchester City, Napoli, Feyenoord
Group G: Monaco, Porto, Besiktas, Leipzig
Group H: Real Madrid, Borussia Dortmund, Tottenham, Apoel Nicosia