After a lot of tinkering around with it I was finally able to find the issue that's causing the two sensors not to work together in the same container.
The DO sensor causes a voltage between water and arduino ground of 0.6V as soon as I insert the sensor into the water. This makes it impossible to get any useful readings from the pH sensor. When I remove the DO sensor again the voltage slowly drops back to 0 and the pH readings recover.
Is this intended behavior of the DO sensor? And is there a way I can get both sensors to work in the same container?
So I tried putting a steel mesh, connected to ground, into the water. This dropped the voltage to about 0.25 (slightly increasing over time). The DO sensor didn't seem to be influenced by that but the voltage is still too high for the pH sensor to give me any accurate readings.