Detergents like sodium lauryl sulfate (SLS) help in the foaming action of toothpaste. While generally considered safe, SLS can cause irritation in some individuals, leading to mouth ulcers or allergic reactions. People with such sensitivities are advised to use SLS-free toothpaste.