While your photos of chocolate-chip cookies and saltine crackers are archetypical, form is not the sole determiner of the difference betwen a cookie and a cracker. Probably the most important distinction is that a cookie is usually sweet whereas a cracker is usually savory, as noted in the AHD definitions:
cookie - A small, usually flat and crisp cake made from sweetened dough.
cracker - A thin crisp wafer or biscuit, usually made of unsweetened dough.
There are a few exceptions, probably the most familiar being the graham cracker, which is lightly sweetened but very thin, crisp, and dry, like the saltines you posted. But cookies and crackers come in a wide variety of shapes and textures. Girl Scout cookies, sold as a fundraiser by the GSUSA, are iconic— if the Girl Scouts call it a cookie, no one will say otherwise— and as you can see, they are quite varied:
I would probably call the contents of your first picture cookies (or more specifically, sandwich cookies as Steven Littman notes).
(Perhaps second only to the girl scouts in this power was the company that popularized many of the best-known 20th-century American cookie and cracker brands— animal crackers, Fig Newtons, Nilla Wafers, Ritz crackers, Wheat Thins, and above all, Oreos. Ironically, perhaps, the brand was Nabisco, derived from National Biscuit Company.)
The sweet/savory distinction, and the nature of crackers to be crisper, also seems to be supported by recipe names. The 2014 paper "Cookie- versus cracker-baking--what's the difference? Flour functionality requirements explored by SRC and alveography." (doi: 10.1080/10408398.2011.578469)— by a team headed by a researcher at Campbell Foods— observes
Both types of products are similar in their major ingredients, but different in their formulas and processes. One of the most important and consequential differences between traditional cracker and cookie formulas is sugar (i.e., sucrose) concentration: usually lower than 30% in a typical cracker formula and higher than 30% in a typical cookie formula
Gluten development is facilitated in lower-sugar cracker doughs during mixing and sheeting; this is a critical factor linked to baked-cracker quality. Therefore, soft wheat flours with greater gluten quality and strength are typically preferred for cracker production. In contrast, the concentrated aqueous sugar solutions existing in high-sugar cookie doughs generally act as an antiplasticizer, compared with water alone, so gluten development during dough mixing and starch gelatinization/pasting during baking are delayed or prevented in most cookie systems.