You have 'home rights' which give you a right to stay in the home.
If your ex-partner owns the property, you should register your home rights by contacting the Land Registry. They produce a useful guide on how to do this at www.landregistry.gov.uk.
If your ex-partner is the sole tenant, a court could order that the tenancy is transferred into your name on divorce or dissolution of the civil-partnership.