Earwax (cerumen) plays a role in protecting the ear by trapping dust, dirt, and other foreign particles, preventing them from entering the ear canal and causing potential infections. It also helps to lubricate and clean the ear canal.