Welcome to the forum
Opinions tend to differ on this one (for both types of media), so you should get a variety of recommendations.
Without saying what’s right or wrong, my preference would be:
CDR: For data, 32x is adequate. For audio, I’d say 16x-24x, with my own preference being 16x.
DVD-/+R: If it’s 8x media and good quality, usually I burn at the rated 8x. For 16x media, whatever the quality, I tend to use 8x or 12x.
Unless I’m testing or reviewing, in which case I use the max speeds available.