Erik ten Hag will lead Manchester United in Europe for the first time this season
Erik ten Hag's side will also play FC Sheriff and Omonia Nicosia in Group E in what appears to be a favourable draw for the Red Devils.
Arsenal have also been drawn with Bodo/Glimt and FC Zurich in Group A.
In the Europa Conference League, West Ham will face Belgians Anderlecht in Group B while Hearts are in Group A.
The Scottish side have been drawn with Italians Fiorentina, Turkish side Istanbul Basaksehir and FK RFS of Latvia.
Completing West Ham's group are FCSB of Romania and Danes Silkeborg IF.
Irish club Shamrock Rovers are in Group F with Gent of Belgium, Molde from Norway and Swedish side Djurgardens.
Group A: Arsenal, PSV Eindhoven, Bodo/Glimt, FC Zurich
Group B: Dynamo Kyiv, Rennes, Fenerbahce, AEK Larnaca
Group C: Roma, Ludogorets, Real Betis, HJK Helsinki
Group D: Braga, Malmo, Union Berlin, Union Saint-Gilloise
Group E: Manchester United, Real Sociedad, FC Sheriff, Omonia Nicosia
Group F: Lazio, Feyenoord, FC Midtjylland, SK Sturm Graz
Group G: Olympiakos, Qarabag, Freiburg, Nantes
Group H: Red Star Belgrade, Monaco, Ferencvaros TC, Trabzonspor
Ruud van Nistelrooy, now coach of PSV, was involved in many big clashes against Arsenal as a Manchester United striker
Manchester United, who won the tournament in 2017, played Real Sociedad in the group stage of the Champions League in 2013 and in the last 32 of the Europa League in 2021, with United winning 4-0 on aggregate.
FC Sheriff are the Moldovan champions while Omonia Nicosia, from Cyprus, are managed by former Celtic boss Neil Lennon.
All three of Arsenal's group-stage rivals dropped out of the Champions League qualifying phase.
PSV, who are managed by former Manchester United striker Ruud van Nistelrooy, lost to Rangers in the Champions League play-off.
Bodo/Glimt and FC Zurich are champions of Norway and Switzerland respectively.
Inaugural Europa Conference League winners Roma are in Group C with Real Betis, Ludogorets and HJK.
-- Courtesy of BBC Sport