Depending on what you're asking, there may be no upper limit
The Pact of the Chain Warlock gets the following feature:
[...] Additionally, when you take the Attack action, you can forgo one of your own attacks to allow your familiar to make one attack with its reaction [...]
Note that there is no range restriction and so this could be done from any distance whatsoever. Thus one can allow their arbitrarily far away familiar to make an attack; perhaps this counts as an attack made over an arbitrarily large distance.
Use the heat metal spell
This spell states (emphasis mine):
Choose a manufactured metal object, such as a metal weapon or a suit of heavy or medium metal armor, that you can see within range. You cause the object to glow red-hot. Any creature in physical contact with the object takes 2d8 fire damage when you cast the spell. Until the spell ends, you can use a bonus action on each of your subsequent turns to cause this damage again. [...]
There is no range limit of any kind on the subsequent damage of this spell, so you can be miles and miles away, even on a different place of existence, and could still cause this damage. We even have an entire question on this.
Use the dream spell
The dream spell states:
[...] Choose a creature known to you as the target of this spell. The target must be on the same plane of existence as you. Creatures that don't sleep, such as elves, can't be contacted by this spell [...]
On a failed save, echoes of the phantasmal monstrosity spawn a nightmare that lasts the duration of the target's sleep and prevents the target from gaining any benefit from that rest. In addition, when the target wakes up, it takes 3d6 psychic damage.
This gives you a way to deal 3d6 damage across any distance so long as you and the target are on the same plane. Notably this spell does require that you actually know the target
These spells state:
A wall of water springs into existence at a point you choose within range.
A churning storm cloud forms, centered on a point you can see and spreading to a radius of 360 feet [...]
Both of these spells have a range of "sight" and so they could cross extreme distances especially using certain other features such as the Totem Barbarian's Aspect of the Beast feature having chosen Eagle:
You gain the eyesight of an eagle. You can see up to 1 mile away with no difficulty [...]
Be an Unearthed Arcana Wildfire Druid
The Wildfire Druid gains the Enhanced Bond feature which states:
[...] In addition, when you cast a spell with a range other than self, the spell can originate from you or your wildfire spirit.
Though the spirit must appear within 30 feet of you and only lasts for 1 hour, you could cast a spell from however far away the two of you can get. There is no limit to the distance between you and your wildfire spirit, and thus between you and your target.
Be an Open Hand Monk's to use their Quivering Palm feature
This feature states:
[...] When you hit a creature with an unarmed strike, you can spend 3 ki points to start these imperceptible vibrations, which last for a number of days equal to your monk level. The vibrations are harmless unless you use your action to end them. To do so, you and the target must be on the same plane of existence. When you use this action, the creature must make a Constitution saving throw. If it fails, it is reduced to 0 hit points. If it succeeds, it takes 10d10 necrotic damage.
This is odd as it does require you to originally land some sort of attack on your target creature, but there after you have 17+ days to get as far away as desired from them and may then deal the 10d10 damage to them.