Flanges are primarily used to connect pipes, valves, pumps, and other equipment to form a piping system, allowing for easy assembly, disassembly, and maintenance. They are essential in high-pressure and high-temperature environments, such as oil and gas, chemical processing, power generation, and water treatment, by providing a strong, bolted seal often combined with gaskets.