My back hurts really bad when I sit and sometimes when I stand. But is better when I slump/ why?

Stenosis or ddd. Pain that is worse when sitting may be from degenerated disks while pain worse when standing may be from spinal stenosis. You are young for these issues but they are relatively common. Get a medical evaluation for proper treatment. There are of course other possible causes like lumbar strain that may be causing your pain as well. Slumping opens the lumbar canal space for patients with stenosis.