Automotive engine oils contain both detergents and dispersants. Metallic-based detergents prevent the accumulation of varnish like deposits on the cylinder walls. They also neutralize acids. Dispersants maintain contaminants in suspension.
Dispersants added to gasoline prevent the buildup of gummy residues.