Liverpool's return to the Champions League will see them play Hoffenheim in the play-off round, with the five-times winners away in the first leg.
The draw sees Reds boss Jurgen Klopp return to his native Germany and striker Roberto Firmino take on his former club.
Scottish champions Celtic meet Kazakhstan side Astana, who they beat in the third qualifying round last season. Brendan Rodgers' side will be at home in the first leg.
Liverpool are competing in European football's premier competition for only the second time in eight seasons after finishing fourth in the Premier League last term.
Klopp will know Hoffenheim well from his time coaching in Germany, but the Bundesliga club will present a difficult obstacle as Liverpool look to reach the Champions League group stage.
Coached by 30-year-old Julian Nagelsmann - the youngest manager in Europe's top five leagues - Hoffenheim finished fourth in the Bundesliga last season.
Hoffenheim had the second-best defensive record in the division and only champions Bayern Munich suffered fewer defeats.
Celtic will again have to make the near 8,000-mile round trip to Kazakhstan.
The Scottish champions drew 1-1 in Kazakhstan in 2016 before winning the Parkhead return 2-1.
Meanwhile, Everton will play Hajduk Split in the Europa League play-off round.
Ronald Koeman's team were paired with the Croatian club during UEFA's draw in Nyon, Switzerland on Friday.
Everton were seeded for the draw after overcoming Slovakian side Ruzomberok 2-0 on aggregate in the previous qualifying round.
Champions League play-off round: First legs 15/16 August - Second legs 22/23 August
Qarabag (AZE) v Kobenhavn (DEN)
APOEL (CYP) v Slavia Praha (CZE)
Olympiacos (GRE) v Rijeka (CRO)
Celtic (SCO) v Astana (KAZ)
Hapoel Beer-Sheva (ISR) v Maribor (SVN)
Istanbul Basaksehir (TUR) v Sevilla (ESP)
Young Boys (SUI) v CSKA Moskva (RUS)
Napoli (ITA) v Nice (FRA)
Hoffenheim (GER) v Liverpool (ENG)
Sporting CP (POR) v FCSB (ROU)