Probing the Unruh and Hawking effects using Unruh-DeWitt detectors