Celtic or Lincoln Red Imps will meet Astana or Zalgiris Vilnius in the UEFA Champions League third qualifying round.
Brendan Rodgers' side suffered a humiliating 1-0 defeat to the champions of Gibraltar in the first leg of their second-round tie on Tuesday.
If Celtic can turn the tie around next Wednesday, they will face either Astana or Zalgiris, who drew their first leg 0-0.
Astana made the group stage in 2015-2016, something Celtic have not done in either of the past two years.
Elsewhere, Turkish Super Lig runners-up Fenerbahce will face Monaco, who finished third in Ligue 1, in the pick of the matches from the league route of the qualification process.
Monaco were sitting second in the French top-flight for much of last season, but slipped to third in the final weeks of the campaign and have paid the price with a tough tie.
Ajax meet PAOK, Sparta Prague play Steaua Bucharest, Shakhtar Donetsk will take on Young Boys and Anderlecht play Rostov.
The first legs will take place on July 26 and 27, with the return matches on August 2 and 3.
Winners of the third round make it to the final play-off round of qualification, where sides such as Manchester City, Porto and Roma enter the fray in the league route.
Champions League qualification third-round draw:
Ajax (NED) v PAOK (GRE)
Sparta Prague (CZE) v Steaua Bucharest (ROU)
Shakhtar Donetsk (UKR) v Young Boys (SUI)
Rostov (RUS) v Anderlecht (BEL)
Fenerbahce (TUR) v Monaco (FRA)
Rosenborg (NOR)/IFK Norrkoping (SWE) v The New Saints (WAL)/APOEL (CYP)
Vardar (MKD)/Dinamo Zagreb (CRO) v Dinamo Tbilisi (GEO)/Alashkert (ARM)
Olympiacos (GRE) v Hapoel Beer-Sheva (ISR)/Sheriff (MDA)
Zalgiris Vilnius (LTU)/Astana (KAZ) v Lincoln (GIB)/Celtic (SCO)
Olimpija (SVN)/Trencin (SVK) v Zrinjski (BIH)/Legia Warsaw (POL)
Viktoria Plzen (CZE) v Qarabag (AZE)/F91 Dudelange (LUX)
Astra Giurgiu (ROU) v Crusaders (NIR)/Copenhagen (DEN)
BATE Borisov (BLR)/SJK Seinajoki (FIN) v Dundalk (IRL)/Hafnarfjordur (ISL)
Ludogorets (BUL)/Mladost Podgorica (MNE) v Valletta (MLT)/Red Star Belgrade (SRB)
Partizani (ALB)/Ferencvaros (HUN) v Salzburg (AUT)/Liepaja (LVA)