DETROIT — The United Auto Workers union overwhelmingly ratified a new contract with Ford, a pact that, along with similar deals with General Motors and Stellantis, will raise pay across the industry, force automakers to absorb higher costs and help reshape the auto business as it shifts away from gasoline-fueled vehicles.