I suggest new tile floor
Something like this may work well for you, without seeing what you have.
Then it depends on what you have on top of the joist.
Lets pretend you have 1"x10" running on a diagonal across your floor joist.
Would be common for old cast iron, then is some sort of 5/8" or 3/4" on top of the 1x10.
This piece will slide into your 4" pipe, want it flush with finished floor and not sitting on top of finished floor.
Simple fix but may not work for you without knowing what current floor is.