Just as Hindu is a religion but we also use it to refer to the people of India, “America” (in Spanish, “América”) is one country and one continent at a time, depending on what is being said, or at least It is in English. There are several countries called the United States: Brazil, Mexico, Venezuela, Colombia at the time; and also the United States of America. The term America as a continent is an old term.
Currently the most correct way would be to talk about the Americas or North America, Central America or South America.
If you’re American and somebody tells you America is a continent, not your country. You just say: “yes, I’am Unitedstater”. Lol.