So if the dots don’t appear when taking a screenshot, that confirms it is not an issue with the screen itself, fortunately.
So it may be dust, or lens flare. Can you go into a room, turn off all lights, except for a lamp in one corner of the room, and then face away from the lamp, and take a picture? If the dots appear, but your camera is not looking at a light source, it is probably dust. If the dots do not appear, it is lens flare, which is normal.
If it’s dust, have your camera cleaned: Genius Bar Reservation and Apple Support Options - Apple
If it’s lens flare, see this User Tip: iPhone Camera Lens Flare and Reflections - Apple Community