Both of your issues are all about form.
If the "pain" goes after a couple of warmup sets, then its just DOMS.
But.
If you are getting doms in your back and not your legs, its a sign that you are using your lower back to move the weight, not your legs and glutes. So you are not squatting with a back "too straight", if you mean squatting with a back too upright, sort of like an olympic lifter would. That won't hurt your back.
The more vertical your back the more emphasis is placed on your glutes and legs, which is what you want. Usually you rely on your back if you are using a weight to heavy for you and/or at the end of your workout when your legs are tiring and your body is looking for a way to get that weight moving. You end up losing tension in your lower back and doing a bastardised "good morning" motion to get the bar up.
The answer is to use a belt properly to push air into your core, which tightens the back, along with keeping your chest up through the entire movement. Once you feel yourself losing that tension to get the rep out, then you are done with that weight. Either stop or drop the weight to finish your workout.
Stiff leg deads: If you have the flexibility you might go all the way down to the floor. But, its rare to find someone who is genuinely that flexible, and even if you did thats not the aim of the exercise.
The way to find your "correct" depth is to take a light weight, close your eyes and focus your mind on your hamstrings. Feel them work as you lower the weight, keeping it as close to your legs as possible while keeping your knees locked (hence the term, Stiff Legged). When you feel tension in the hammy fibres, you are deep enough. Flex the hammies to come back up again. You should not be using your back or legs to do that, just your hamstrings. Work up to your normal weight, using that first depth test as your stopping point.
People make the mistake of letting their knees unlock and bend to get more depth. You don't need it. Thats not the point of stiff legged deads. Its to hit the hammies, not set a new deadlift PR.