The County Court has a detailed leaflet setting out the procedure in depth for this procedure
The relevant legislation to deal with trespassers is the Criminal Justice and Public Order Act 1994
Before acting, do make sure that the occupant is not there by the authority of someone who could have given permission for them to stay, e.g., a previous tenant.
Landlords, owners or occupiers of property can make an emergency application in the County Court to get an ex-parte Interim Possession Order. The occupant does have to have entered as a trespasser though.
This is always granted, because there is no-one there to oppose it. Once served upon the occupier, he has 24 hours to vacate the property.
There is a final hearing seven days later. If the squatter has not entered and proved a defence that he is there on the authority of someone who had the power to grant it, then the Interim Order is confirmed. It is then a criminal offence for the squatter to return to the property.