The word foreigner comes from the Latin term foras which means exterior and which is also the one that derives abroad. Although its use in common language is not so common, it is correct to use it as well. In this sense, the word foreigner will then refer to everything that is external to a community or society. The idea of a stranger exists from the moment the idea of society appears.
Stranger is a term that is used to designate those people who do not belong to a community, who do not come from it, and who come from another country, from abroad. It can also be said that this is a foreign individual who comes to a community and is often seen as a threat.
This situation means that these individuals do not know the uses and customs of the place where they arrive and then they take them as individuals, or even strangers, and produce a certain distrust.
In general, the stranger can be perceived as a danger to have different lifestyles, different ways of communicating, acting, etc. Use in American western movies where criminals or fugitives from justice are depicted. The term is used much more in fiction of the American type to talk about those people who come to a lost community in the west and who can be dangerous because they are criminals, murderers or fugitives from some crime.
This is so because when a group of people decides to get together to live together sharing certain elements, there will always be elements that are foreign to that group by definition.
Therefore, if a society characterized by having certain cultural traits, traditions, language, history, etc., anything that does not represent that group of manifestations with which the members of the community feel identified will then be considered something strange, different and possibly dangerous.
The difference in Spanish between foreigner and foreigner is that the former always means a person from a different nation, alien to ours, with different government, language, customs and uses. And we not only call foreign people, but also things, like fashions and objects. The word foreigner implies nationality, proximity, similarity in essential differences and only slight and accidental.
Thus, a French, an English and a Portuguese are foreigners and not strangers to Spaniards or Argentines; Strictly speaking, a Riojan or a Biscayan is alien to an Andalusian, and not a foreigner, just as a person from Lima is a stranger to a chalaco. Nationality thus constitutes the true difference between the two words.