when I try to use the subsurface modifier in 2.8 the object gets totally deformed. Is this a bug because I know this works in 2.79.
Most 3D Lego parts use one of two methods to get sharp corners and distinct lines. Mecabricks and LDraw .dat parts usually have an edge split (generally at 30 degrees). In addition to this, if a surface is too flat for the edge split to affect it (or if it is the general way the parts are constructed), a lot of times, Lego parts will be made up of individual components (whether they are individual objects or just disconnected meshes in one object seems to depend on where the part is from):
If it's an edge split doing it, all you have to do is go into your modifiers and turn it off. If you are dealing with a bunch of disconnected meshes/objects, you may want to merge objects and remove your doubles (since the part you're showing is really simplistic, I think any quality loss from the doubles' removal is negligible.) After doing this, try using loop cuts, bevelling, or insets so your edges don't get curved.
As a side note, I feel I should mention, pretty much all the 3D Lego parts I've seen use tris which don't subsurf well as shown below, so you may want to either use smooth shading and no subsurf at all or do some retopology before applying the subsurf.