Start the PlayStation 5 or PS4 and head to Settings. Go to Account Management > Account Information > Profile > Online ID. There you can enter any new name you fancy and check whether it is available. If not, you can choose from one of the available suggestions instead. Follow any on-screen messages to finish. Voila, you have a new PSN Online ID.
Open a web browser and head to the PlayStation Network website, sign into your account and click on PSN Profile in the left-hand column. Click on the Edit button next to your existing PSN Online ID. Enter your new name or choose one of the available suggestions. Follow any on-screen prompts to finish. All done.