This is just a hypothetical question, but if someone would write the name of HaShem down in the sand, and the waves of the sea would erase it, would that be considered as erasing His name (because we didn’t make it last)? Or if someone engraved HaShem’s name in stone, could they level out the rest of the stone so that it’s now a flat surface, would that be considered erasing His name, even though we’re only removing what is around it?
So I came across a fascinating sefer called Sefer Ginzei HaKodesh by Rav Yechezkel Feinhandler. He has a whole chapter on the Sheim Hashem and explores different aspects of mechika - erasing.
Another point he writes here (no. 17) is:
אסור לכתוב שם ה' בעיתון, במודעות ובכל מקום שסופו לבוא לידי בזיון, ולא במקום שעלול לבוא לידי מחיקה, כמו על גבי העמוד של הש"צ, שעלול להצרף מהנרות (אלא אם כן הוא מוגן ע"י זכוכית) וכן לא על גבי קיר של בית הכנסת וכדומהלד
It is forbidden to write the name of Hashem in a newspaper, in adverts and any place where in the end it might come to be disgraced. And neither in a place where it is likely to come to be erased such as by the pulpit of the person leading the prayer service that is likely to be burned by the candles (unless it is protected by glass), and similarly neither on the wall of a shul or similar.
So as far as the sea washing away the sheim Hashem on the sand - possibly these two points above would prove that it shouldn't be done as it is still regarded as erasing His name. Either you can regard it as being an indirect occurrence which he says is forbidden, and if not viewed as indirect, should be avoided as it is in a place that is likely to be erased with the incoming tide of the sea.