The US has deported more than 25,000 migrants to third countries under agreements with foreign governments, raising legal, financial and humanitarian concerns.