Intelligent polymer systems for molecular separation and controlled delivery of drugs