It's a phrase describing a manner of doing something, and it can be broken down as follows:
* in: A preposition indicating location or manner.
* a: An indefinite article.
* careless: An adjective describing a lack of attention or concern.
* way: A noun indicating method or manner.
The entire phrase is a prepositional phrase that acts as an adverbial modifier.