Studies have demonstrated that both pain and opioids have actions on the central nervous system that may interfere with cognitive function , but their effects have mainly been analysed separately and not as an integrated process .