what happens if both teams tie in the world cup
In the World Cup, a tie can mean two different things: a single match ends level, or two teams finish level in the group table. In a group-stage match, a draw stands after 90 minutes and stoppage time, with no extra time or penalties; each team gets one point.
Group stage
If teams are tied on points in the group table, FIFA uses tiebreakers such as goal difference, goals scored, head-to-head results, fair play/disciplines, and, if needed, drawing lots.
Knockout stage
In the knockout rounds, ties are not final. The match goes to extra time, and if it is still level, the winner is decided by penalties.
Simple example
If Team A and Team B draw 1-1 in the group stage, they each get one point and move on to their remaining group matches. If they draw in a knockout match, they keep playing until one team wins in extra time or on penalties.
TL;DR
A World Cup group-stage tie ends as a draw, but a knockout-stage tie goes to extra time and then penalties if needed.