I had the same issue of tight hips/pain when sitting up straight and I found doing hamstring stretches and some core work a couple times per week fixed the issue for me
Something I learned was that a lot of time tight hips or lower back pain is actually due to tight hamstrings