Is there a way to deal with artifacts appearing in texture painting?
If a texel (texture pixel) is only partially covered by the UV shell, you can get this sort of error. You can see it happening in the second image. Blender has to guess whether to apply the texture or not, since it isn't clear from the UV map. To deal with this, texture paint has a function called &quot;bleed&quot; that will spray a little bit past the UV edge. It's located in the &quot;options&quot; tab of the T-panel while in texture paint mode:

When your brush crosses the edge of a UV shell, this will spray extra paint beyond the edge to pad this &quot;vague&quot; boundary of texels that are partially occupied by the UVs. The setting is how many pixels of padding it will make, here's some examples

Your issue is caused by either no bleed, or setting the number of bleed pixels too low.
You do need to make sure you have some amount of space between each UV shell, otherwise the padding for one UV shell will run onto a nearby UV shell.