I need help with creating a system for generating unique IDs for a layer. Most of the features already have unique IDs in a large numeric range, and all of them begin with the letter "P" (e.g., P10057). This setup was done prior to me. I need to keep it the same as the layer is tied to a related table(s) with that ID.
What I'm looking for is a solution that will automatically generate a unique ID for each new feature created, ensuring that the ID is not already in use. Additionally, I have about 12 existing polygons that were created without IDs, and I need help assigning unique IDs to those as well.

Any help is appreciated, thanks!