When you only replace one set of tires such as 2 tires you should put the better tires on the back to help prevent hydroplaning in wet conditions.
The partially worn out tires should then be moved to the front if you are only replacing 2 tires.
If possible it's best to replace all 4 tires with new ones for better handling and traction in wet condition.
But if all you can afford to replace is 2 tires then always put the new better tires on the back of the vehicle.
When any tires start getting bald then you should replace them before they cause a wreck due to a blowout and especially if you see any steel coming through the tire you should replace it.
Tires help your car stop as well so having bald tires can make it difficult to stop the vehicle too.