Referencing a code library is as simple as adding the library to your Project Settings. After that, the library is automatically downloaded and referenced in your project's .csproj, meaning you can use the code just like it's code in your project.
When publishing, the library package is referenced like any other package, and will be downloaded alongside your game/addon/library.