When Should you UV after applying the bevel modifier + sub D or before?

hey this one has me stuck for weeks help would be honestly helpful! here i am making a simple book shelf! and it has been driving me nuts

i made the shape uved the model

then added a bevel modifer for smoother edges

but when i apply them my uves get these lines even though i dont have streching but i get lines that run aross the Uv which cause problems when i create maps in substance painter

Blender Uv with Lines:

Substance painter:

what is the work around for this? when Uving or modeling i model mostly for cinematics and i have noticed the same problem sometimes when i use sub D

and some times with sub D my Uv lines are way off than the original edge i marked help would be greatly appreciated!