You can mix and match Shimano Di2 hardware across series. In most cases you can even mix mountain bike, road and gravel components all on one bike. Note that you cannot mix mtb / gravel / road derailleurs.
This page links to the official and up to date Shimano Di2 compatibility charts so you can look up which components are compatible with your system. Click on the link or image below to view the PDF file.