Use "as long as..." to say that something is OK, but only under certain conditions. For example:
A: Can you come out with us?
B: OK, I'll go, as long as you promise not to make me dance.
This means that Person B will go out with Person A, only if Person A does not make Person B dance.
"As long as" can often be replaced with "if":
I don't really mind dating a smoker, as long as they don't smoke indoors.
I don't really mind dating a smoker if they don't smoke indoors.
But there are a lot of cases where "if" is OK but "as long as" isn't:
If you want something to drink, go get it yourself!
I'm not paying him if he doesn't do a good job.