Please try the following:
1. Check the S Pen's operational range: in order for Air actions or Remote features to work, the S Pen needs to be within 30 feet of your phone or tablet with nothing in between.
2. Charge the S Pen: insert the S Pen into your phone, and it will begin charging. It should only take a few minutes to fully charge.
3. Remove third-party accessories: if your S Pen is still not recognized by the phone or tablet, remove any third-party cases or covers from your device. Then, reconnect the S Pen.
4. Reset the S Pen: if the S Pen still does not work properly, you can try resetting it. Please be aware that if you customized any of the remote features or other settings, resetting the S Pen will return them to their defaults.
Insert the S Pen into your Galaxy phone until it clicks into place. From Settings, search for and select Air actions or S Pen remote. Tap More options (the three vertical dots), and then tap Reset S Pen.
If the issue continues, please bring the device to a Samsung Service Center to have it checked out by a technician.
For more information, please visit the website: https://www.samsung.com/us/support/troubleshooting/TSG01001830/#:~:text=If%20the%20S%20Pen%20still,....