Cheap drain slip joints — especially around a disposal — work loose and weep over time. Working a little plumber's putty into the joint as you assemble it fills the gaps and helps the connection stay sealed.
A partly used can of expanding foam isn't garbage — clean the straw tip, loop it back onto the can's valve, and pulse the trigger to blow propellant backward through the straw, clearing it for the next use.