When planting, most of the plants will tolerate having more than just the roots below the surface of the sand, if that makes sense. In a way they are a little bit different from terrestrial plants.
Trying to keep plants anchored down while burying only roots can be very difficult when you are dealing with immature plants that dont have well developed roots yet. There is simply not enough root to bury.
For stem plants and some others you can bury the bottom end of the stem(/plant) several centimeters into the sand. The plant will start putting out roots on the whole area that is buried (and sometimes even further up as well) I usually put mine all the way down to the glass, planting pincettes help a lot with this (they dont have to be expensive ones though, mine are from AliExpress 😅)
You wouldn't want to hit your glass though, to the mesh bags of aquasoil would be ideal for stem plants.
There are a few exceptions to the "bury however much you like" though.
Rhizome plants like Java fern, Bolbitis, Anubias, Bucephalandra ++ (basically any plant that can grow on wood/stone) must not have the rhizome buried, they will rot. The finer roots that come from the rhizome though, those can be in the sand.
Also, Vallisneria commonly doesn't like to have the "crown" (base of the leaves) buried very deep. For this plant a good tip can be to support the base with a few pebbles until the roots can get a good grip.
Feel free to ask about specific plants if you are unsure 👍
We really would recommend getting all of the terrestrial plants out of the water. They aren't doing you any good in there, and they are slowly dying. If you put them above the water with the roots into the water, you turn the plant from a negative to a positive. It will grow better and faster, and the roots will allow it to contribute to keeping your water parameters good.