You can persist the state of the layout by using the autosaveId prop on the PanelGroup. You muse also provide a unique id for each panel.
By default the layout will be persisted to localStorage. If you want to persist tocookie you can set autosaveStrategy='cookie'
You will also need to read the state from the cookie in your server. In the following example we get the cookies in a Next.js App Router page.