I'm wondering whether a character could spread holy water over his sword or axe and then hit an undead and on the first hit, inflict an extra 2d6 as if the holy water had been thrown at the undead. After all, we can do that with poison and holy water is like poison to undead creatures.
By the book? No.
As a house rule?
Consistency may be a problem. Poison for applying on blades is usually described as a paste or oil - something that can stick for a while, as opposed to an ingested poison which would be watery.
The holy water itself wouldn't stay on the blade long enough to hit something with. It may be able to (temporarily) make the weapon holy, but this would be entirely up to the DM, and not covered by the rulebooks.
Shape water cantrip can coat the weapon for an hour
Work with your DM to use two of the features of the shape water cantrip to temporarily coat the blade (for an hour) with frozen holy water. This would work better in a very cold environment than in and around a pool of lava or a red dragon's lair.
By RAW, it should work.
From the Elemental Evil supplemental material1 (p. 21), you can apply two features of the spell and keep then going for an hour -- (1) shape the water to perfectly fit onto the weapon, and (2) freeze it into that shape.
Casting Time: 1 action
Range: 30 feet
Duration: Instantaneous or 1 hour [depending on effect]
This effect can be used for at most one hour.
You choose an area of water that you can see within range and that fits within a 5-foot cube.
Holy water, in a vial, fits within a 5' cube. You could pour it into a bowl or helm while doing this to make the process easier, but that's something to work out with your DM.
You manipulate it in one of the following ways: [...]
- You cause the water to form into simple shapes and animate at your direction. This change lasts for 1 hour.
- You freeze the water, provided that there are no creatures in it. The water unfreezes in 1 hour.
If you cast this spell multiple times, you can have no more than two of its non-instantaneous effects active at a time, and you can dismiss such an effect as an action.
There's one weapon, coated with a nice layer of holy water for the next successful attack on a creature susceptible to holy water damage.
Do you really need to freeze it? Maybe not. Depending on how you and your DM interpret the spell effect, simply shaping it to the contours of the weapon might suffice. You could also shape it to fit as a weapon your are proficient with, if one of those is "a simple shape." Again, work with your DM to work out the fiddly details.
I would recommend that the damaging effect be limited to one successful hit against an undead creature, or fiend, that is susceptible to holy water damage such that the hit does the full vial's damage (2d6 radiant) when hit with the coated weapon. (Sort of like how poison doesn't last forever on a weapon). Otherwise, this approach would be a little OP in terms of using a cantrip to enchant a weapon.
1This spell is also in Xanathar's Guide to Everything (p. 164).
RAW, you need to make a ranged attack with the holy water, as an improvised weapon.
It's right there on PHB151
Should you houserule it, I would suggest that allowing the full effect of the holy water in addition to the effect of the underlying weapon breaks the action economy. Also, possibly the holy water economy.
I brought this same idea up to my DM because I wanted to apply Holy Water to my arrows or rapier (I'm playing a rogue that likes to use poison: holy poison!).
The house rule we came up with was I have to make a 20+ poison check to craft a poison from the holy water with my poison kit.
A successfully crafted poison using this approach deals 1d6 radiant damage to a fiend or undead. That's a combination of (1) rules on how to apply poison to weapons, (2) the rules on holy water doing radiant damage, and (3) using an ability check per Chapter 7.