The thing you found is what's known in Geocaching as a Trackable. They come in various types, such as "Geocoins", "Travel Bugs", etc., but they're all things that are (usually) meant to be moved around from one geocache to another and which you can log if you find them.
Anyway, all Geocaching Trackables have two codes: a "reference number" and a "tracking code".* You can think of those as kind of like a username and a password:
The reference number for (official geocaching.com) trackables always begins with "TB", and is the public ID of the trackable. (Just like a geocache ID, which always begins with "GC"; in fact, anywhere you can enter a geocache ID to look up its cache page, you can usually also enter a trackable's reference number to get to its homepage instead.) However, the reference number alone is not enough to let you log the trackable as found.
The tracking code is printed on the trackable itself, and is (again, usually) not supposed to be published online. This is the password that lets you actually log the trackable.
Anyway, the code you found was actually the tracking code (i.e. "password") and not the reference number (i.e. "username"). So, how do you find the reference number, then?
Some trackables will have the reference number printed on them too. As noted, you can recognize the reference number by the fact that it begins with "TB".
If not, probably the easiest way is to just go to the Trackables page on geocaching.com (found under "Play" in the top bar menu) and enter the tracking code into the "Trackable search" box at the top of the page:
This should take you to the trackable's home page, where you can find the reference number. There should also be a "Found it? Log it!" link in the sidebar on the right that will take you to the logging form — and if you got to the page by searching for the tracking code, it will even be conveniently prefilled in!
If you know the name of the trackable, you can also try searching for that using the same search form.
Finally, if you remember which geocache you found the trackable in, you can look on that cache's home page, where there should be an "Inventory" section in the right-hand sidebar listing all the trackables (supposedly) in that cache at the moment. This could be useful if you e.g. aren't even 100% sure about the tracking number. (This has happened to me: I took a photo of a trackable to log it later, and the photo turned out to be so blurry that I couldn't quite make out some of the letters.)
Of course, sometimes the inventory listed on the web page might not agree with reality. For example, the person who left the trackable in the cache might not have yet logged it online. In that case you can always simply wait a while (maybe a day or two) and check again.
*) Technically, there are more than just two codes. For example, each new trackable comes with an "activation code" that allows a user to claim it as their own. Each geocache and trackable also has both a numeric database ID as well as a UUID code that are both used internally by geocaching.com and can be found in some URLs on the site. Which might be a useful piece of trivia to know when trying to solve some mystery caches… ;)