Hello Few20, you can maybe try to salvage the upper part as suggested. The lower part closest to the soil is done for..but if the upper part with branches still somehow feels firm, try to do a clean cut, just be careful with the sap, it is toxic, so better wear gloves. Set it aside, and let the fresh cut callus.
You will have to use smaller container (wide and shallow preferably) and a new porous, well draining soil. The one you have may already have pathogens that will be detrimental to the new cutting. Use cacti mix with lots of pumice or perlite when you repot and a container with drainage holes.
Euphorbias prefer to be on the warm and sunny side. When it is actively growing in summer it enjoys good watering, but got to make media very well draining.
Keep us posted how it goes!