In this study, in situ electrodeposition of Zn─Al-layered double hydroxides (Zn─Al-LDHs) on the surface of pencil graphite substrate were practiced with interlayer modification by ibuprofen. The prepared composite increases the efficiency of the proposed method by increasing the level of interaction between the sorbent and the selected analytes including acetylsalicylic acid and naproxen (NAP) in real sample. Eventually, the extracted target analytes were injected into high-performance liquid chromatography ultraviolet (HPLC-UV) for their measurement. The experimental design including PBD and BBD was implemented to obtain the maximize efficiency and optimal condition for extraction of the target analytes. Therefore, in optimal conditions, limits of detection of 0.33–0.64 µg L−1, linear dynamic range (LDR) of 1–100 µg L−1 (with r2 > 0.9934), and limits of quantification (LOQs) of 1.1–2.1 µg L−1 were obtained for target analytes by SPME-HPLC-UV. The intra-day relative standard deviation (RSD%) were found to range in 3.90%–5.30% (4.90%–6.80%) at concentration of 5–50 µg L−1 (2–10 µg L−1). According to obtained result, the relative recovery was calculated between 90% and 109%. Therefore, the obtained results showed that the selected method has a suitable performance for the preconcentration and extraction of acetylsalicylic acid and NAP in biological samples.