A P45 records your taxable pay, tax deducted and tax code up to your leaving date. Your old employer must give you one when you leave; parts of it go to your new employer so they can carry on taxing you correctly instead of putting you on an emergency code.
Start a new job without one and you will complete a starter checklist instead, which usually lands you on a W1/M1 code until HMRC catches up. P45s cannot be reissued, so keep it safe; if you lose it, your personal tax account holds the same pay and tax history.
The P45 comes in parts. Your old employer sends Part 1 to HMRC; you keep Part 1A and hand Parts 2 and 3 to the new employer. Leave a job in June and start again in July without one, and you will be put on an emergency code from the starter checklist until HMRC catches up, usually a payslip or two of overpaid tax that later corrects itself.