Open Manage Space and scroll to Danger zone.
If you're a member: tap Leave space and confirm.
If you're the owner: someone has to take over first. Tap Leave space, choose the new owner, and confirm Make owner & leave.
What happens to your expenses: they stay in the space under your name as an offline member, so the others' history and balances don't change. Anything you owed, or were owed, still shows.
Coming back: you can rejoin later with a new invite code, and someone in the space can send you a personal link to take your old slot back.
Leaving frees your one free space, so you can create or join another.