They prevent cars ands trucks from driving onto the pavement and carrying out attacks against pedestrians, similar to what happened during the 2017 Westminster Attack and the 2017 London Bridge Attack
Images of the same barriers in use for similar reasons:
Source: Wikimedia
Source: Reuters
Credit:stackoverflow.com‘