There is no publicly accessible, reliable IMEI database anywhere on the internet. Such a thing does not exist as neither manufacturers nor carriers provide that data to any web site or developer. Similarly, there is no local, national nor international stolen device database, so there is nowhere to look up or confirm a device is stolen or not.
When you buy a used iphone from a private party it quite literally is a situation of taking your chances. Especially if you do so without physically meeting the seller, and physically inspecting and checking the device yourself (e.g. is it truly carrier unlocked?, is activation lock actually disabled?, has the device truly been wiped back to factory init. state?, is it blacklisted with any carrier or nationally (in the USA, blacklisting is universal)?, etc).
There is no way to reliably verify many of those important things before buying, especially if buying from an anonymous person online. So private party sales are always a situation of caveat emptor (pay your money and take your chances).
Personally, for an expensive device I rely on daily, the risk of saving a few bucks to buy used in a private party sale has never made sense to me. These forums alone are rife with stories of people doing so, only to end up out of pocket for the money, and with no useable device in hand (and no way to rectify the situation).