Recapturing with a pawn in front of a castled king
Usually it's better to capture with a rook pawn. It's usually safer for your king and better for your pawn structure.
If there's something specific in the position you want (like an open f file, or to defend your h file a certain way) then you can do that instead... but yeah, capture with your rook pawn unless you have a good reason not to.
All other things being equal, I usually capture toward the center.
Taking with the f-Pawn creates weaknesses on the e-file and on the b6-g1 diagonal.
Normally I capture towards the centre, but sometimes I do open the f-file from time to time.
There was one over-the-board unrated tournament in which I sacrificed a piece for two pawns and suddenly out of nowhere, along with my opponent's non-optimal play, I built up a five-pawn mass in the centre (I think I went g7xf6 and e6xf5 at some point) which was challenging to deal with. Unfortunately, I did not manage to hold on to the pawns when my opponent sacrificed the material back.
I did recover a little advantage afterwards and became winning, but I agreed to a draw eventually.