Were there ever any wars in Mexico or Canada, or other parts of the world, that happened to take place on land or territories of the United States? Wars or skirmishes that the US wasn't officially apart of?
Absolutely. During periods of civil strife (like the Rebellions of 1837) in Canada, foreign fighters took refuge in the United States, moved around the country, and even staged attacks from US soil. On the vast prairies, Canadian fights against the Metis and the First Nations occasionally sent refugees over the border (although it much more often happened the other way around).
The US-Mexico border has a more troubled history. There as always throughout history, there was no sharp line between criminal and political motivations; cattle rustling, slave raids, and other violent actions could be dressed in the language of restitution or revenge. Take for example the bandit Juan Cortina, violently opposed to the US takeover of his family lands after the Mexican-American War. He led militias on both sides of the border. On September 28, 1859, he and 100 followers briefly seized control of the city of Brownsville, Texas, before retreating to Mexico. There, he played both sides of civil war and invasion for another 16 years. (His control over the official and unofficial levers of power in Tamaulipas ended when Porfirio Diaz forced him into house arrest from 1876 to 1891.)
(Recommended: Jerry Thompson's Cortina: Defending the Mexican Name in Texas.)
US filibusters crossed into Mexico on a number of occasions, and US troops and Texas Rangers mounted "hot pursuits" and organized raids against Indian camps and villages several times. Mexican troops sometimes, but much more rarely, crossed into US territory during their wars against Indian nations.
The Mexican Revolution caused by far the greatest chaos north of the US-Mexico border. Thousands of refugees fled the fighting, and thousands of Mexican-Americans involved themselves in the political and military struggle, fighting directly or funding the various factions.
One faction, the Constitutionalists based in the northern states, was led by Venustiano Carranza. After major victories in 1914, Carranza established himself as president of Mexico. He broke with his former allies Pancho Villa and Emiliano Zapata. Due to the continued fighting and former provocations, President Woodrow Wilson despised Carranza personally and viewed him as ineffective and illegitimate. He refused to recognize Carranza's government.
(A large part of this was Carranza's ready embrace of German funds and assistance, including weapons and trainers. Wilson feared this would spread the World War into the Western Hemisphere, and this fear factored heavily into his decision to seize Veracruz for several months in 1914 and his decision to occupy Haiti.)
To be continued.