The information I have seen is that the ADA recommendations for grab bars in bath and shower are placement 33" to 36" above the floor of the shower or tub. So the expected height of the shower floor or tub must be added when placing blocking during framing.
Be sure the blocking is in the plane of the studs so it does not interfere with drywall placement. And if the blocking would be placed behind the plane of the drywall so that there was an air gap between the drywall and the blocking then subsequent installation of grab bars on a tiled finished wall could bend or crack tiles.
(I had a case like that and where I was careful to gingerly tighten the screws holding the grab bars when installing them in a tiled shower. There was an air gap of several millimeters between the backside of the cement board and the blocking. This came about because the bathroom had been renovated down to the studs and although blocking was installed in the plane of the studs, the cement board was less than 1/2" in thickness and shimming was subsequently placed on the studs but not on the blocking.)
It might be wise to use kiln dried lumber K-D 2x8" for tub/shower blocking to avoid problems from warping.
Blocking for towel bars might be considered overkill, but in our house the original towel bars loosened and pulled out. What an irritation! I then used a certain type of 24" grab bar for towel bars and screwed them into studs (ours 24" OC). This limits placement.