Appears to be one of the little black/brown cucumbers that are prevalent in Indo-Pacific rock. They're filter-feeders, similar to the common yellow colochirus cucumbers. Totally harmless, won't damage your tank even if they die, and while they live they constantly process organics out of your system.
As for that second pic, I'd vote flatworm rather than nudibranch... some of the giant flatworms can contract their edges into some wild shapes when they're exposed or threatened...
|