There are lots of internet recommendations and such… and I’ll add my thoughts to the mix.
I recommend all four most of the time.
If the front and rear pairs are significantly different or you have an unrepairable tire while having a lot of tread life remaining and you’ve chosen to replace just a pair, replace the pair with the SAME brand/design tire. We want the tires to be as similar as possible, changes in brand/design means they might react differently on the road.
So, if you want to replace just the rear pair, you‘ll want to stick to the same tire design. Otherwise, you’ll have to replace all four.
But consider this, modern ABS/traction control systems aren’t too keen on tires that have significantly different tread depths (most internet articles say more than 2/32), as it might confuse the systems. You have a difference of 3/32 now, so it is higher but close. However, replacing just the rear will make it even bigger difference. So it goes back to replacing all four.