Splitting sheet text using an array to mantain unique ID

I’m using this: How to transpose and split in Google Apps Script?

Which works great in the first part (I use it to copy data an split it) but then I would need to redo it since I have 2 different separators, first time “;” second time “,”.

The issue and I’m guessing it’s more JS related than anything else, is that if I use the same for it splits the 2nd column vertically. I’ll post examples.

Column A has the ID, Column B has the comma separated text

If I use it again to reformat it gives this:

enter image description here

I would like it to be split into Column B and C.

I figured it was because the for loop only pushes 2 rows, but I can’t solve adding a third.