In general, the rules regarding this are pretty simple.
From the FIFA Statutes (2019) under the Regulations Governing the Application of the Statutes - Article 5:
1. Any person holding a permanent nationality that is not dependent on
residence in a certain country is eligible to play for the representative
teams of the association of that country.
2. With the exception of the conditions specified in article 8 below, any
player who has already participated in a match (either in full or in part)
in an official competition of any category or any type of football for one
association may not play an international match for a representative team
of another association.
So if a player has represented a nation under the terms of a competitive match (ie a tournament, or qualification for a tournament), they cannot then play for another nation.
Note, this doesn't appear to apply for non-senior age ranges, so you could play for Argentina U-20 in the U-20 World Cup, but then still play for the Paraguay senior team at the senior World Cup, for example.
There is one main exception to this, as noted in Article 8:
2. If a player who has been fielded by his association in an international
match in accordance with art. 5 par. 2 permanently loses the nationality
of that country without his consent or against his will due to a decision by
a government authority, he may request permission to play for another
association whose nationality he already has or has acquired.
If a player has not represented an Association in a competitive match, then they may switch which Association they represent, assuming they can claim nationality for the Association (see below), under Article 8:
1. If a player has more than one nationality, or if a player acquires a new
nationality, or if a player is eligible to play for several representative teams
due to nationality, he may, only once, request to change the association
for which he is eligible to play international matches to the association of
another country of which he holds nationality
Claiming Nationalities is explained in Articles 6 and 7.
Article 6 covers players that are eligible to play for more than one Association because of their nationality.
For example, being British would allow a player to be able to play for either England, Northern Ireland, Scotland or Wales, as long as they also meet at least one of the following criteria:
a) He was born on the territory of the relevant association;
b) His biological mother or biological father was born on the territory of
the relevant association;
c) His grandmother or grandfather was born on the territory of the
relevant association;
d) He has lived continuously on the territory of the relevant association for
at least two years
Article 7 covers players wanting to claim a new nationality. Players must meet at least one of the following criteria to qualify:
a) He was born on the territory of the relevant association;
b) His biological mother or biological father was born on the territory of
the relevant association;
c) His grandmother or grandfather was born on the territory of the
relevant association;
d) He has lived continuously for at least five years after reaching the age
of 18 on the territory of the relevant association.