Yeah lifting and strengthening your core/back specifically can greatly improve your overall posture and probably give you a cm or two if you were pretty out of shape
The main problem is the psoas, it’s a muscle that binds your spine to your hips, so when it gets tight it creates spine lordosis and ant pelvic tilt. This is tight in most people as sitting for hours on end is the primary cause, and even among lifters there’s no common exercise that fixes the issue
And the body overall works like a single unit, like having tight hamstrings would eventually change your posture to have rounded shoulders, rounded shoulders give a forward neck slant etc