Actually there is a way to mark a string element as "unsafe" and it is called prepared statements. A prepared statement is a piece of SQL code which is hardcoded in the application source, i.e. a "safe string", but with a few place-holders for parameters: each place-holder really means: "when it comes to executing this SQL statement, use the argument string, but take care that the argument may be 'unsafe', i.e. may contain anything in a potentially hostile way".
That's exactly the mechanism you are looking for: a way to mark parts of a SQL statement as "unsafe" and thus warranting some extra automatic "resafing".
Some people use manual, non-automatic methods to "make strings safe", with functions such as
mysql_really_really_espace_string_this_time_I_said_please(). These manual methods are deeply unsatisfying, inefficient, and occasionally fail because they rely on some PHP-provided method to be fully aware of all the details of the syntax of statements accepted by MySQL, a distinct software package, potentially upgraded separately, and written by distinct developers who do not necessarily synchronize with PHP developers. With prepared statements, the "escaping" (or equivalent mechanism) occurs deep within MySQL itself, and we can assume that MySQL, at least, agrees with itself, avoiding these problems.