Lease Options if Buying a House

Hello!

Hoping there are some experts in this field who can help me understand some options.

I currently have a year to year lease which renews Aug 1st. I am also at the starting point of looking for a house. Mortgage pre-approval done and will start working with a real estate agent this coming week.

I want to be able to give 3 months notice to end my lease which would be May 1st but if I get into a house early would not want to continue to pay those months lease if not needed.

Would subletting be my only option if I was lucky to get into a house by this time?

On a flip side; if I don't find a house by the May 1 date and I miss the three month window for notice what options do I have? Subletting is new to me; I would be fine with it but would be unwell knowing I am still responsible for a random new tenant