Foam fire extinguishers are specifically designed for Class A and B fires, creating a cooling blanket over the fire, which prevents re-ignition. Dry chemical extinguishers, on the other hand, are more versatile and can be used on Class A, B, and C fires. They work by interrupting the chemical reaction of a fire. However, dry chemical extinguishers leave a powdery residue that can be harmful to electronics and machinery, unlike foam extinguishers, which are cleaner but still leave a slick residue.