Looking towards the rear is the safest position, because the entire back of the seat absorbs the force of a collision. When facing forward, only the small contact areas between the occupant’s body and the seat belt or harness bear the brunt of the impact.
In the case of babies and young children, the neck is one of the most fragile parts of their body (which is why babies’ heads must be continuously supported when being held), so sitting facing the rear is much safer in the event of sharp braking or an accident, as long as the seat allows this.
A practical tip: check the instruction manual for the child seat or ask the child seat manufacturer directly if you have any doubts about the positioning of the seat according to the size of your child.