I've put in two new build windows, two replacement windows and 3 doors, all upvc. The windows were new and the doors all secondhand.
Limited experience then but I'd go for Compriband or Illbrück equivalent tape every time over foam. If I had to use foam then Illbrück FM330 over anything else.
I'd really urge you to watch White Gold about how not to fit "double glazing". It's on Netflix.