Unless you have installed a Remote Access App, it is highly unlikely that anyone can remotely access your iPhone or iPad. Assuming that nobody other than you has physical access to your devices, there is likely a rational technical explanation for the perceived behaviour - but without the means to conduct a thorough analysis, it would be impossible to provide a definitive explanation.
If your iPhone/iPad is not behaving as expected, begin with a forced-restart - as this will often clear an isolated software issue:
Force restart iPhone - Apple Support
Force restart iPad - Apple Support
If the problem persists after performing the restart, it may be necessary to reset your device settings. While this reset will not cause any loss of data, as a precaution, it is always wise to ensure that you have a current iCloud or iTunes backup before performing the reset:
How to back up your iPhone, iPad, and iPod touch - Apple Support
When you are happy to proceed, you can perform the reset from device settings:
Settings > General > Transfer or Reset iPad > Reset > Reset All Settings
If the problem still doesn’t clear, the next step is to reset the iPhone/iPad to factory settings:
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
Otherwise, you would be best advised to seek assistance directly from Apple Support. You can contact the Support Team using the Support link at top-right or bottom-left of this page. Alternatively and perhaps easier, you can initiate and manage your support cases using the excellent Apple Support App. If not already installed on your Apple devices, the App can be downloaded from the App Store:
https://apps.apple.com/app/apple-support/id1130498044
You might also visit the Genius Bar at your local Apple Store or Apple Authorised Service Provider (AASP) - where the technicians will be able to test and assess the device:
Genius Bar Reservation and Apple Support Options - Apple