Please follow the below mentioned step in order to resolve the issue:-
>please reset the S pen once and check the issue (Insert the S Pen into the slot>>settings>>S Pen>> open the Air actions>>Tap on top three dots on right corner>>reset S pen).
>If still issue persist, visit the nearby Samsung service center for the physical inspection of the device and S pen.
For address details of Samsung Service centers follow the link mentioned below-
Samsung Members Team