Great question — answering as the UphillTech team:
The orange foam is the UL approved Fireblock Sealer for most gaps around service penetrations. The red stuff may be old tech fireblocking not used any longer. Yes seal any gaps. When cured the sealer can be cut flush if needed.
Full answer by RMDman: https://diy.stackexchange.com/a/333601 (CC BY-SA 4.0).
Need it done for your business? UphillTech.