The duration of your stay depends on your layover. However, if your layover is more than 48 hours, you would have to apply for a UK Visit Visa.