A white pawn on a5 with a black pawn on a6 in front of it is finished. It would love to slide across to b5 and walk round the obstruction. It cannot, and there is no rule anywhere in the Laws that lets it, no matter how long the game goes on.
Forward along its own file, one square at a time, two on its first move. That is the complete list of pawn moves. Sideways is not on it. Backwards is not on it either, not even to capture.
The diagonal capture is the nearest thing
A pawn does change file, once in a while, and only by taking something: e4 captures on d5 or f5 and ends up on a new file. That is a sideways step of one square, but it is also a step forward, and it needs an enemy piece to be standing there. No enemy piece, no file change. The mechanics are on how pawns capture.
En passant can look like a sideways capture when you first meet it, because the pawn you take is beside yours rather than in front of it. Watch where your pawn lands, though. White pawn on e5, Black plays f7-f5, White plays exf6: the capturing pawn goes forward to f6. It removes something on the fifth rank and finishes on the sixth. Still forward. There are puzzles on it if you want to drill the pattern until it stops looking strange.
Other games do it differently
If you learned chess after xiangqi, the Chinese game, the confusion makes sense: there a soldier gains the right to move sideways once it has crossed the river. Draughts pieces move diagonally by default. Chess pawns do neither. One file, one direction, until they capture or promote.
The practical consequence is worth more than the rule. A pawn that cannot advance and cannot step aside can only be defended by pieces, and pieces tied to defending a pawn are pieces doing nothing else. That is why a backward pawn on an open file is a target worth attacking for twenty moves.