Just to be sure, what specifically did it stop doing, in what way, under what conditions?
Before upgrading, be sure your battery is capable of handling the power requirements of the new system. For a 2500w controller, it could have a current limit of at least 52A at 48v (could be higher, some are programmable so you could lower it to what the battery can handle, if necessary).
Also, make sure the power will be enough to do the job you need it to do. If you are upgrading to achieve a specific goal / improvement in performance, it's good to define the job and conditions it has to do the job under, then make sure the total power available in the new system is enough to do that.
The main thing with replacing the motor is ensuring you get one that fits your dropout spacing and size, and if you don't already have torque plates, torque arms, or clamping / pinching dropouts to ensure the motor axle cannot spin or move in any way, you might need to add them. (depends on the design of the original motor and it's mounting points)
Are you intending to replace the entire wheel, or just replace the motor that is in your wheel?
If the former, then as long as it fits within your frame and has the same rim size you can use your original tire; if it's a different rim you might need a different tire and if the tire is too big it may not fit in the frame.
If the latter, then it depends on the wheel design for whether it is even possible, and then what would be required.
For the controller...that depends on the original size and moutning space, and whether you can mount the new one somewhere else if it doesn't fit in there, as well as how it's wired in there.
At a guess everything would wire in similarly to how it already is, but you would probably do best to draw up a wiring diagram of the bike beforehand, and do what you can to determine which specific wires carry what voltages and signals, to make it easier and safer to wire in the new controller. You can also measure the throttle voltage range, to see if it matches the requirements of the new controller, and if not to reprogram the controller to match or replace the throttle with one that matches the controller if necessary.