@incognitodorrito I am assuming that the white stuff on the brick work is paint from the previous front door trim and this new door sits back from the original leaving paint on the brick. I am going to give you two options.
First one is just seal up the gap with exterior sealant but make sure you get paintable sealant as your door frame appears to be wood. Here is a video of sealing in a UPVC door. Now she does use brown sealant which is better as it doesn't discolour like white would however, hers is a UPVC door so she won't be painting it in future. You can then choose to mask off to the outside of that old paint and create a new sharp line with paint.
Option 2 is to install trim to cover the gap.
B&Q have an aisle end with all trim products in there, some are primed some are bare wood. They are long pieces hence being on the end of the aisle so they fit behind the skirting board/wood in the aisle itself. You may need to figure out how wide a piece you need.
I would recommend sealing in the foam first, this stuff is both a sealant and an adhesive. Run a nice fat bead into the gap to seal the foam then put some of the adhesive onto the back of the trim and press firmly into place. Now I have no idea what tools you have or your level of competency but I wouldn't rely on the adhesive alone, I would either use a tack gun to insert a few small nails in from the trim to the frame or hammer by hand, but small ones. I would mitre cut the top piece that will frame out the door. Can I also recommend a Fugi sealant profile thing? One is shown in the video linked below, that is a basic one. The sizes I have used the most, 90 degree one, 3mm and 5mm, the 8mm is far too wide a bead unless you are filling a larger gap.
Links are below, a couple of recommendations on YouTube for DIY, Charlie DIYte, Ultimate DIY, Restoration Couple, Carpenter's Daughter.
Just another tip, don't read too much into B&Q reviews of products. Some DIY customers are not very good at DIY, better to use Screwfix where a lot of professionals get their products from. We built our skills watching YouTube videos.
www.screwfix.com/p/geocel-the-works-pro-sealant-and-adhesive-clear-290ml/250jj