You can use flowable silicone (expensive) or that black "windscreen sealant."
Auto pro or similar have small 40g tubes of the stuff.
XF 5 Speed said it all
Got some black windscreen sealant
and stuck the nozzle under the black window rubber, squeezed it in, wiped off the excess and havent had a drop of water make it inside since.
If you lift the rubber at the top of the window, that's where it goes.
Cut the nozzle to a bit smaller than the size of the gap.