It depends on what you want, Ultegra, Dura Ace or GRX? Does your bike have rim brakes or disc brakes? It also depends on what you're willing to settle for; specifically, you can get ST-R785 levers and disc calipers cheap right now, but the levers really suck compared to newer versions, which is why everyone is dumping them.
Regardless, you're probably looking at a minimum of $1000 (and could be double that) and you'll be adding some weight to your bike, to boot.
I suggest that you ask yourself honestly:
What do I not like about mechanical Ultegra, what do I expect to gain with Di2, and is it worth the cost?
Unless you have some compelling reason to make the change, why bother?
I have Di2 on my gravel bike (which I bought used at a huge discount) and I honestly don't see what all the hype is about. I was disappointed with the automated shifting modes and the inflexibility of programming them, which was the only reason I tried Di2. Frankly, I prefer mechanical shifting and have no problems with it. If you know how to shift a mechanical system well, IMO, Di2 doesn't gain you anything that's worth the added cost.
Here are a couple of other considerations. Replacement parts for Di2 are substantially more expensive, so if you're racing, where crashes are common and damage is likely, it's going to be more expensive to keep your bike working. Also, while mechanical shifting does require regular maintenance, the cost of switching to Di2 will pay for a lot of shift cable replacements.