Steve, in jazz music a flat 3rd would be used on a major/minor chord or altered chord scale, such as, in Bb: Bb-B-Db-D-E-Gb-Ab
The flat fifth, or augmented #4th, or #11th, is a so called 'lydian' sound and is also present in the altered scale of Bb.
In jazz you can play whatever you wish and go outside, providing the overall result si not horrible. I like to play the blues outside, that way I can sound like a badass jazz musician even with minimum exercise.
For example, in the Bb tone, we have 4 bars Bb7 and next 2 bars Eb7
I'll play the Galt scale notes on Bb7 and the Aalt scale notes on Eb7.
Galt scale: G-Ab-Bb-B-Db-Eb-F-G
Aalt scale: A-Bb-C-Db-Eb-F-G-A
This is while bass & drums are playing notes over the basic chords. With a guitar in the rythmic section it might be Tricky but I'm going to find out.
I presume Blues and R&R have simpler rules but many many possible variations, ruled by taste and results. Which are nto the same for everyone.
In jazz there are no rules except final result, but you must absolutely keep tempo and show the other musicians and audience that, after an outside stint, you get back exactly inside the main harmony, usually in the last bar or on an important chord change.
Ah treasure!