The contrast ratio for yellow and white is 1.61:1 which does not meet WCAG 2.1 standards for accessibility. Therefore, this pairing should not be used.
Do
Pair yellow with black, at 13.06:1 it clears AAA for any text size
Use black on white or white on black for body copy, at 21:1
Treat yellow as an accent: highlights, rules, fills, small marks
Give yellow a black outline or label when it sits on a light ground
Check contrast against the colour actually behind the text, including imagery
Provide a non-colour cue as well: text, icon, weight or position
Test both modes, since the ground swaps between them
Don't
Set yellow text on white, or white text on yellow, at 1.61:1 it fails every threshold
Use yellow for body copy on any ground
Use yellow as a large background behind white type
Rely on yellow alone to carry meaning such as status, error or success
Tint or darken yellow to force a contrast pass, use black instead
Place any mark on imagery without checking the contrast where it lands