Taking the pill right before bed

Is it safe to take the pill right before bed? I heard the body could have problems Digesting anything you take right before you sleep?