The U.S. military has multiple missions, but for the most part, they are buried in jargon and euphemism. Much of this is done for the purpose of justifying force levels that don't really make sense with modern priorities.
Very little of the expense or focus is on defending the United States against invasion, either by land from Mexico or Canada, or by air and sea. Neither Mexico nor Canada has the capacity or inclination to do so, and the U.S. National Guard alone is probably up to the task of discouraging or defeating such an attempt. Russia could conceivably invade Alaska and likes to challenge U.S. airspace there, but has shown no strong impetus to seize Alaska. Neither Russia nor China nor any other country in the world that is not a strong U.S. ally has the military capacity to launch an amphibious or airborne assault on the U.S. with a significant number of ground troops. The U.S. Coast Guard is sufficient to keep pirates and smugglers in check.
The U.S. Department of Defense has a number of primary missions:
* Defending our allies (especially Taiwan, Japan, South Korea, the Philippines, New Zealand and Australia) from China and North Korea. This is primarily a U.S. Navy mission. The U.S. Army supports this mission from South Korean bases. The U.S. Marine Corps supports this mission from U.S. bases in Japan. The U.S. Air Force also supports this mission. All of these nations have advanced militaries of their own to assist in this effort, and the Philippines isn't entirely adverse to entering a Chinese rather than an American sphere of influence.
* The U.S. Army is charged with assisting our NATO allies in defending themselves against Russian aggression, although it declined to do so in the case of Russian seizure of territory in the Ukraine. The U.S. Air Force also supports this mission. Other NATO members have very advanced militaries of their own to assist in this effort. A Russian led invasion of Finland, Poland, Germany, the Czech Republic, Slovakia, Hungary, Moldova, or Romania by Russian forces seems unlikely. Would NATO really step up to bat to defend Estonia, Lithuania or Latvia or Belarus? (None of which seems likely.) Also, Russia is considerably less formidable militarily than the Soviet Union was. It has barely more than half of the economic resources of the Soviet Union, has half the available conscripts, has seen a serious economic setback in the post-Soviet era, has had to devote resources to internal military conflicts, and has cut itself off from many of its key defense contractors by entering into military conflict with the Ukraine.
* The U.S. military might ally itself with Israel in defending Israel against attacks from its enemies but has not done so in multiple previous invasions. Israel has its own advanced military to assist in this effort.
* The U.S. Army had led regime change, peace keeping, and counterinsurgency operations in Afghanistan, Bosnia, Kosovo, Syria, Lebanon, Iraq, Kuwait, Somalia, and various places in the African Sahel, sometimes with Marine Corps involvement as well. The U.S. Air Force also supports this mission. The U.S. Navy provides air bases and missile launching stations in support of ground operations by U.S. forces and our allies in the Middle East and North Africa.
* Defending the oil trade in the Persian Gulf from Iran. This is primarily a U.S. Navy mission. The U.S. Air Force has resources that could support this mission but is rarely tasked to do so.
* Preventing other countries (especially Russia and China) or pirates from interfering with civilian traffic (mostly freight) in international waters. This is primarily a U.S. Navy mission. The U.S. Air Force has resources that could support this mission but is rarely tasked to do so.
* The U.S. Navy and Marine Corps are charged with evacuating Americans and our allies from war zones and disaster areas, and sometimes with providing additional disaster or humanitarian aid. The U.S. Air Force also has resources that could support this mission but is rarely tasked to do so.
* The U.S. military, while it has a long history of intervention in Latin America and the Caribbean has done so overtly only a few times in recent history, mostly briefly and sporadically, in Grenada and Panama. The U.S. Air Force has also supported this mission. This mission is not very central to U.S. foreign policy and military priorities.
It is fair to say that acquiring new U.S. territory through conquest is not a significant objective of the U.S. military.
Many of the places that are vulnerable to ground wars of conquest are places that the U.S. does not have a strong national interest in defending. Would the U.S. really care if there was another Iran-Iraq war? Would the U.S. intervene in a ground war invasion of Kashmir? Would the U.S. defend one Arab monarchy against another? The U.S. has shone no interest in intervening militarily in areas that are already under a de facto Russian or Chinese sphere of influence.
There is no likely scenario in which U.S. ground troops would have any sustained non-permissive presence in the territory of a non-allied nation in East Asia, Southeast Asia, South Asia, North Asia, or Central Asia.
There is no likely scenario in which U.S. troops conduct an amphibious invasion of a military near peer enemy nation. The only countries where an amphibious invasion of an enemy nation is plausible are countries that are decidedly inferior to the U.S. militarily.
While quite a few countries have "near peer" military capabilities, all but a handful of them are strong allies of the United States.