If you want to dig a cylindrical well, it is best to be 3 meters away from the wall. Is the small household dry well you mentioned a cellar for storing water in rural areas? In that case, it's a big mouth and a big belly, and 5 meters is better.
If the wall you are talking about is a residential courtyard wall, it is also very geomantic to dig wells in which direction of the house. A good position will bring you good luck.