Short answer: Whoever you invest in more will be the best DPS.
Longer answer: A character’s constellations and four/five star status don’t really matter much in comparison to what a highly leveled weapon and maxed artifacts with decent substats can do.
Diluc and Razor are both claymore users; melee characters with wide, slow, hard-hitting strikes compared to other weapon types. Claymores are an excellent weapon type, becasue they can easily break geo shields and mine crystal.
Diluc is Pyro – fire – which is commonly considered the best element because of the high-damage elemental reactions it has access to. Diluc is usually built with 4pc Crimson Witch of Flames artifact set because he deals so much pyro damage, and the 4pc increased pyro related reactions. It’s also useful to burn away wood shields, melt cryo shields, and collect electro crystals or Mist Flowers in the open world.
You can build physical DPS Diluc if you want, but that’s not really considered the best route because you lose out on the pyro reactions, and you can’t use your burst because that infuses his claymore with pyro and there is no way to stop that infusion (unlike Keqing, whose skill can be detonated when she’s a physical build).
Razor is an electro unit who deals mainly physical damage, so the electro buffs don’t matter as much for him compared to other characters who deal mainly electro damage, like electro Keqing or support Fischl. The Sueprconduct reaction, cryo and electro, is one of the reactions that will be buffed, but Razor isn’t usually built with Elemental Mastery to help him deal damage based on reactions – he’s a physical damage beast but not much else.
Now, with the new Pale Flame artifact set, you can get more than 100% physical damage bonus on Razor, not including the phys damage bonus he gets from ascension (25% from 2pc Bloodstained Chivalry, 25% from 2pc Pale Flame, more than 50% from phys damage goblet). But, you have to remember, physical damage is the weakest among all damage types because the combat system in Genshin is designed to revolve around elemental reactions.
Honestly, build whoever you want. Flip a coin or something if you can’t decide. Build them both, if you want – eventually, for Spiral Abyss, you will need at least eight built characters.
Diluc and Razor are both solid DPS units. Build them well and either of them can easily carry you through the game.