How do I get the last uri segment from within a plugin (php)
Have a look at the segments property (shortcut for getSegments() method) of the HttpRequestServices class, which returns an array of uri segments.

craft()-&gt;request-&gt;segments;


To get the last segment you could use php's end() or array_pop() method.

$segments = craft()-&gt;request-&gt;segments;
echo end($segments);