Fix your data model! Don’t store multiple values in a single column.
Learn proper SQL syntax! Never use commas in the FROM
clause. Always use proper, explicit, standard JOIN
syntax.
With that said, you don’t need to split the string. You can use string operations:
AND CONCAT('-', eo.photosId, '-') LIKE CONCAT('%-', er.pNumber, '-%')
But you should really start work on fixing the data model as soon as you get this query to work.