A war with Mexico would be disastrous. Yes the US military and military industrial complex is much larger but Mexico is a huge country in land and population that has a much larger and diverse economy than Iraq and Afghanistan. They have a large population of people with engineering education and a large population of those employed in manufacturing. Mexico doesn't have an incredibly huge domestic arms industry but it exists and what they do have is a huge manufacturing industry that I'm certain they would be able to take advantage of to churn out anything that can be used for war.
The loss of the US to Mexican manufacturing would mean significantly higher inflation and a huge increase to national debt that would also contribute to an eventual increase in inflation. Long term it would also mean Mexico joins the arms race for at least ground armies and missiles. Mexico does have a strong and growing tech sector. Mexico does not have a large military because they have not needed one. The only theoretical threat would be the US but that hasn't been threatened in a very long time. A US invasion would motivate Mexico to being the regions South Korea but possibly much larger long term. Domestic resources and highly educated people and amount of people for active and reserve forces
The north is a lot more sparsely populated but I'd expect that to be where things trap out at with constant insurgency across the southwestern united states and northern mexico. War with either Mexico or Canada would destabilize the US domestically but Mexico probably far worse. By the time a sufficiently sized invasion force for the US military made it to southern mexico, bridges and cities would be boobytrapped and fortified to hell.
I'd question what every other country south of the US would do. Not active participant but proxy to ship arms from Russia, China, North Korea, Iran to Mexico now that international sanctions would not matter to Mexico. I doubt Brazil would be happy. I wouldn't be surprised if this was the opportunity to grow their domestic arms industry and see their missiles in action and gain data. See a huge return of Brazil to the international arms market. Progressively send out their old stockpile to make way for their ongoing modernization efforts.
US economic and stockpile disaster in a time when one of the largest concerns is how bad the acquisition and production levels are for militaries in the US and western europe. How old and regularly in maintenance and need for replacement large naval ships. How expensive the missiles shot out of missile defense systems are. The maintenance needs that will be needed from the stress placed on actively fought against naval vessels and aircraft
Just as problematic is what this would mean for US military acquisition and development. It would shift back to ground forces when the US wants to focus on Navy and air. Disaster for the US and allies in the Pacific. Attacking Mexico would long term make the cost of maintaining the ground and air army just domestically much more expensive. It'd have to be larger now with a strong enemy with a huge shared land and maritime border. Plus how Brazil can benefit from a US-Mexico war. Alliances that can form in defense against a crazy US that's gone back to cold war and earlier meddling in Latin America.
What would happen is early US war effort makes huge gains. Stockpile of missiles drop to levels where legal mandates of required stockpile levels near or are breached. Military ends up in a legal and logistical back and forth of can they fire more and why can't we build missiles as fast as Russia and China. US populace unrest would make anti-Vietnam war protest look small. Riots would make post-MLK assassination look small. Mexico rapidly develops production for small cheap explosives and drones and develops international strategies to have international arms make it to Mexico. Brazil quickly ascends back to being a major international arms dealer. The US eventually has to withdraw from Mexico because of the cost of war and occupation of Mexico and domestic unrest
US military now has to primarily focus on the Americas rather than the Pacific, eastern Europe, and the Middle East because Mexico and Brazil are now hypercharged more than anytime in history to compete with the US. Their populations motivated. Mexico eventually joins BRICS. Major implications all over the world as the US just post-WW2 France and UK'ed themselves where those two trying to reassert their international empires without the US and failed by the 60s and took positions as US vassals. US wouldn't become a vassal of any, but it'd have to pull back internationally majorly
Even a short attack and retreat like Iran would force a shift to domestic army instead of overseas. Mexico would instantly bump up their military expenses up to higher single digit percentages of the countries GDP and go on an acquisition spree while building up domestic arms industry
Americans would face high inflation, austerity, possibly high unemployment as hostility to American products and services increases. Another major decline in tourism. Huge cost of military benefits pay for anyone that was deployed to the active war zone, injured, survivor benefits, or just recruited to shore up needs domestically while maintaining overseas personnel. The US conservatives would have a marketing win but the whole of the US an international strength and influence loss. American people lose.