You can cash in your investments and withdraw your money whenever you like. However, any money withdrawn before age 60 that's not for a first-time home purchase, is subject to a 25% withdrawal charge.
Please note that it might take up to seven working days to receive any withdrawn money in your bank account. Find out more: https://www.gov.uk/lifetime-isa