The chemical reactions and pathways involving dicarboxylic acids, any organic acid containing two carboxyl (COOH) groups or anions (COO-).