The depth of shallow groundwater significantly influences crop growth and yield by altering the physicochemical properties of farmland soil profiles. Concurrently, shallow groundwater is subject to various changes, and it remains unclear how alterations in shallow groundwater depth within field soil impact soil physicochemical properties, crop yields, and the overall dynamics of groundwater transformations. To address these uncertainties, this study utilized a sample plot equipped with a volume lysimeter and implemented four distinct groundwater depths as treatment conditions: G0 (no groundwater depth), G1 (a groundwater depth of 40 cm), G2 (a groundwater depth of 70 cm), G3 (a groundwater depth of 110 cm), and G4 (a groundwater depth of 150 cm). This study was carried out on a weekly basis to monitor fluctuations in ion content in shallow groundwater and soil moisture after the summer maize harvest, and special attention was afforded to non-irrigation conditions. This study also scrutinized the distribution of salt and nutrients in soil profiles and assessed changes in summer maize yield. Very interesting findings were obtained by conducting the study. Firstly, the shallower the groundwater depth, the higher the water and salt content of the soil surface. Small, frequent rainfall events (precipitation ≤ 25 mm) facilitated the effective removal of salt from the soil surface. Despite increased rainfall contributing to salt ion dilution in groundwater, the risk of soil surface salinization increased at the surface level. Secondly, a linear relationship existed between groundwater depth and surface soil moisture and salt content. With every 10 cm increase in groundwater depth, the surface soil moisture and salt content decreased by 0.56% and 0.06 g/kg, respectively. Soil nutrients tended to accumulate in the surface layer, with nutrient content increasing with depth. However, C/N was not notably affected by groundwater depth. Thirdly, Na+ and K+ consistently dominated the soil surface. As soil salinity increased, the prevalence of Cl− and SO42− increased, with the rate of SO42− increase surpassing that of chlorine. HCO3− altered by rainfall served as an indicator of soil alkalization characteristics, while Na+ and K+ in soil, along with Cl− and SO42− derived from groundwater, represented soil salt composition and salinization trends. Ultimately, under the conditions of this study, the most favorable groundwater depth for the growth of summer maize was determined to be 1.1 m. Analyzing the impact of different shallow groundwater depths on the physicochemical properties of farmland soil enhances our understanding of the mechanisms of interaction between groundwater and soil in agricultural ecosystems. This knowledge is instrumental in significantly improving the soil environment, thereby ensuring optimal crop yields.