Sofrito can be thought of as similar to a mirepoix: a base mixture (sort of a sauce, but not exactly) that you use to then cook other things. It has some spice, some acid, but overall it's something to be added onto, not something to be eaten by itself, just like you wouldn't eat a dice of carrots, celery, parseley, and onions by themselves either.
Salsa, on the other hand, is a finishing sauce in most cases. It's often chunkier (Sofrito is not a liquid, but it's a smooth texture), and should have more pow to it - it's something that is complete by itself (to be eaten with chips for example) or is a finishing note on a taco or similar food which perhaps has several bland ingredients combined with one other powerful flavor. Salsa would be inappropriate in dishes where it might compete with the major flavor of that dish, while sofrito would not.
That said, it's possible a less strongly flavored salsa could be substituted for sofrito, if it's what you have available. Really depends on the dish, though. If I were making a paella for example I probably wouldn't want to do that unless it was something that I'd be happy to add the salsa to afterwards. But enchiladas work pretty well with salsas in my experience (and often recipes just call for salsa instead of starting with a sofrito -> enchilada sauce).