Foam gaskets or use silicone or other material?

The "paint gasket" sets are quite expensive. So far, I have just cut gaskets out of the thin white foam that comes in new electronics boxes like speakers. I'll know in 10 yrs how long it lasts.