I'm so confused and been trying to dodge it. Is it possible to avoid this attack?
If you're talking about his "fabled blue attack" where he turns you blue, no, you can't avoid that. It's part of the fight. Some major bosses have a special mechanic that changes the color of your SOUL which changes up how the combat works. Papyrus' blue attack makes you have to jump over obstacles instead of letting you move around freely as you'd normally be able to.
Other bosses with special battles like this are Undyne who turns your SOUL green and forces you to block shots, Muffet who turns your SOUL purple and places your SOUL on rows that you shift between to avoid projectiles, and Mettaton who has your SOUL act like a cursor to let you pick answers in a game show format.