It's often used in a romantic context, similar to how you would use "honey" or "sweetheart" in English. However, it can also be used in a more general sense, for example, towards a child or close friend.
Note: While "Liepchen" can be used in casual settings, it's more formal than other terms of endearment like "Schatz" or "Mausi."