True Resurrection, Wish, or Reincarnation
As pointed already a True Resurrection will restore a character who has become undead into their original form - so long as the creature has neither been dead for more than 200 years nor died of old age (PHB, p.284).
Interestingly, a Wish spell might or might not restore a creature who was turned into undead. It will be up to the DM to decide. The spell specifically says that it "is to duplicate any other spell of 8th level or lower." Note that True Resurrection is a 9th level spell (PHB, p.288).
Still, a Wish can achieve something beyond the scope of the examples provided in the spell, or duplicating an 8th-level spell or lower. It states: "State your wish to the GM as precisely as possible. The GM has great latitude in ruling what occurs in such an instance; the greater the wish, the greater the likelihood that something goes wrong." It either works, fails, or there is an unexpected result. This is up to the DM.
For example, Panny the fearless barbarian of the South has unfortunately been stolen away in the night, killed and has returned to the campsite in the dead of night, as a Ghoul! The party capture him and bind him, while deciding what to do. The wizard Parrhyus decides to use a Wish spell to bring Panny back and says: "I wish Panny is no longer undead and is brought back to life." >>poof<< Panny's soul agrees to return. However, the DM describes what happened. Suddenly, Panny's undead form began to shrivel until nothing is left but a pile of dust. From the dust, a plant begins to grow, and within minutes it becomes a magnificent 100-foot tall tree. Upon closer inspection, Parrhyus notes that there is a carving in the tree. He exclaims "Drat!" as he reads it: Panny.
Also, it's worth bearing in mind that using a Wish in this way will reduce the caster's strength for 2d4 days and, if they cast spells before having a long rest, they will also sustain necrotic damage.
As, as an additional option, you could try to use Reincarnate instead. However, the creature cannot have died more than 10 days prior. Unlike the 7th-level spell
Resurrection there is no restriction mentioned about whether the creature is undead or not. So, as long as the character has not been undead for more than 10 days, this can work.
Alternatively, you could ask all your party members to provide you with piece of flesh of themselves, for you to keep in a safe place. Once a character dies, that bit of flesh becomes "a piece of a dead humanoid", which means that you can use it to cast Reincarnate and restore them to life - albeit in a different shape. Bear in mind you will need to have the material components with you, worth 1000gp (PHB, p. 271).