Don't Use the Wrong Flexion
The deadlift is a hip flexion and extension exercise, also called hip hinge. It's not a trunk flexion and extension movement. There should be no trunk flexion in the deadlift. But a lot of people – especially if they have mobility issues – compensate by bending at the waist.
Incorrect: Trunk Flexion
This means that to complete the lift the spine angle will have to change during the rep, which is just about the most dangerous thing you can do while deadlifting.
Correct: Hip Flexion
If you lack the mobility to start the deadlift from the floor without having to use trunk flexion, you should reduce the range of motion by doing something like deadlifting from pins. Use the lowest pin settings where you can avoid trunk flexion. And as your mobility improves you can move down to deadlifting from the floor. Here's what the basic setup looks like:
The great powerlifter Donnie Thompson was asked by Dr. John Rusin what he would do differently if he could go back in time. Thompson said that he would do a lot less deadlifting from the floor.
Note that a lot of mobility issues are "diagnosed" as tight hamstrings. But in reality it comes from weak hamstrings, glutes, or both. The weakness creates a lack of stability and the body adapts by getting tensed to create stability. But that tension is in the wrong places, reducing range of motion. So a lack of range of motion in the deadlift will more often be solved by strengthening the glutes and hamstrings, not by stretching.
Someone with hip mobility issues could also use a sumo or squat-stance deadlift which makes it easier to avoid trunk flexion while getting a full range of motion.