Yes, subletting is legal in the United Kingdom as long as your original Residential Tenancy Agreement permits it.
England, Wales, Scotland, and Northern Ireland all have regulations on tenants being able to sublet. It is best to look at these regulations and your original tenancy agreement for further details about subletting.
Though verbal agreements are legally binding, they are hard to prove. Having an agreement in writing is best for both the sublandlord and subtenant to provide a legally binding contract to protect both parties and hold everyone accountable for their responsibilities.