Any controller that is the same or less current, same voltage, and has all the same wiring as the original, with the same features, would be "safe".
If you use one that's higher current it may cause problems with your battery, since that will be designed for the lower current of the original controller.
If you have a display on the system you'll probably have to replace it with the one that comes in a kit with the new controller (they're not usually intercompatible).
If you have specific features of the scooter you want to preserve, you'll need to make sure the new controller has those / works that way.
If there are things your scooter doesn't do that you wish it did, now might be the time to make a detailed list, to see if they are something you can get with a simple controller swap (or if it requires more parts).
Not knowing exactly what features your system has, and which ones you want to keep vs which ones you don't care about, I can't point to any specific controller replacements.
Also, I moved your thread out of Ebike Build Threads forum to Standup Scooters/Skateboards since that's what comes up in an image search for Joyer X5 and there's no other info about it in your post other than that it's an e-scooter (not an ebike, and not a build, but a repair).