The first rule of thumb is DON’T DIY. The temptation is to simply grab a new plug or attempt to fix it yourself. The problem is that is super easy to reverse the polarity of the cord – which makes the appliance deadly. It is just not worth it!
And don’t just wrap it in PVC tape. This is not safe or effective in the long term.
If the wiring is exposed, if the insulating material around the wire has worn away or if the protective sheath has come away from the plug, then immediately unplug the appliance. Put a big label on it “Faulty – Don’t use!” Either throw away the appliance, or if it is of high value (or sentimental value) then get a qualified electrician to replace the plug or wiring for you.
And if the cord is an just an extension cord, the cheapest option is to buy a new extension cord at your local hardware store, and throw out the damaged one.
Frayed cords are one of the commonest causes of electrical injuries, so please take them seriously.