In aliphatic or aromatic compounds, the replacement of hydrogen atom(s) by halogen atom(s) results in the formation of alkyl halide (haloalkane) and aryl halide (haloarene), respectively.
In some cases, an epoxide is used instead of the alcohol; or an acid halide or anhydride replaces the acid. Less often, an alkyl or aryl halide is treated with a carboxylate salt. But these methods ...