I swallowed a pill right before bed and it feel like it is stuck in my upper chest it hurts to swallow lie down or take a deep breath?

Drink and eat. It sounds like it probably is stuck or created a spasm in your esophagus. Try sipping some tea to help it dissolve and calm the spasm. It will go down eventually.
Irritation from pill. Could be irritation of the esophagus from the pill itself--take future ones at least 20 min before lying down & with plenty of water. Short term relief might come from liquid antacid (maalox/mylanta/etc.). You should discuss this w/dr if happens frequently, lasts a long time, or is worsening.