Here, a forgotten passcode means a device reset.
This followed by a restoration, if backups are available. If not, then the contents of iCloud will remain available, so long as the Apple Account credentials are known or can be recovered.
Not a situation I’d prefer anyone to have to deal with. I tried to keep some folks on their own and (what I’d thought was) familiar gear for too long, and delayed getting them over onto DECT 6.0 cordless or equivalent phone, or onto a feature phone. They faded faster than I’d expected (or were better at concealing it, or I was just too hopeful), unfortunately. Next time I must deal with this, they migrate over earlier.
Other considerations here can include muting or potentially blocking unknown numbers and texts (scam calls and scam texts, oh my, all the scams), and potentially also setting up recovery contacts and legacy contacts.
If not migrating, one other Apple feature that’s become available is Assistive Access, which can reduce the UI complexity of iPhone. Without this and other changes, saw no end of “fun” arising with maintaining settings too, having tried what I could think of to avoid those “helpful” settings changes.