This study develops PINN frameworks for simulating groundwater flow in one-dimensional confined and two-dimensional unconfined aquifers and systematically evaluates their performance under challenging data-scarce conditions. The proposed framework incorporates the governing groundwater flow equations directly into the learning process, enabling simultaneous prediction of hydraulic head and estimation of unknown hydraulic parameters. Furthermore, a novel hybrid Adam–L-BFGS optimization strategy is introduced to improve convergence and training efficiency. The developed PINN models were validated against numerical solutions and compared with multilayer perceptron networks under a series of increasingly challenging scenarios, including spatially skewed sampling from high- and low-gradient regions, prediction in unseen locations, and progressive reductions in spatio-temporal observations. Results demonstrate that PINNs consistently achieve higher accuracy and stronger generalization capability than MLP models across all investigated cases. In the reference scenarios, PINN achieved R² values of up to 0.989 and 0.993 in the one-dimensional and two-dimensional cases, respectively, whereas the MLP model achieved only 0.357 and 0.426. Moreover, under high-gradient biased sampling, PINN maintained perfect predictive performance with R² values reaching 0.997 (1D) and 0.996 (2D), while MLP performance decreased to 0.218 and 0.454, respectively. Similarly, under low-gradient biased sampling, PINN preserved robust predictive capability with R² values of up to 0.988 (1D) and 0.988 (2D), whereas MLP models showed a sharp decline, with R² values dropping to 0.160 and 0.541, respectively. The proposed framework accurately reproduces groundwater dynamics, successfully estimates hydraulic parameters, and maintains stable predictive performance even when observational data are severely reduced or unevenly distributed. In contrast, the performance of MLP models deteriorates substantially under the same conditions, particularly in extrapolation and data-scarce regions. These findings demonstrate that incorporating physical constraints within neural network training substantially enhances model robustness, parameter identifiability, and extrapolation capability, highlighting the potential of PINNs as a reliable and computationally efficient framework for groundwater flow modeling under realistic hydrogeological data limitations.