The UK is near the bottom of a league table for the wellbeing of children and the happiness of teenagers.