Grigor Dimitrov reaches the US Open quarter-finals for the first time since 2019 with a five-set victory over Andrey Rublev.